Is it possible to have two different layouts for different cases in the same activity or do I have to use intent
to call another activity
with a di
There are a number of ways to go about this. The other answers include at least two approaches - using setContentView depending on the case and using fragments. There is one more I'd like to talk about. Say for instance, you include two layouts
In your java code, you can then hide or show your layouts depending on the use case. For instance, setting the content view to show the layout above shows layout1. When user clicks next button, you can then get a reference to layout1 and set it's visibility to gone and layout2's visibility to visible.
LinearLayout layout1 = findViewById(R.id.layout1);
LinearLayout layout2 = findViewById(R.id.layout2);
buttonNext.setOnClickListener(new View.OnClickListener()
{
layout1.setVisibility(View.GONE);
layout2.setVisibility(View.VISIBLE);
});