I have one activity Select which has four buttons and other activity Result. Now i want to implement such logic that if button1 is pressed then it should show one EditText and one TextView in Result activity but if button2 is pressed then it should show 3 TextViews.
in other words i want to call a Result Activity with different views for different button clicks.
Please help me i am new in android development.
Thanks in Advance.
I have one activity Select which has four buttons and other activity Result. Now
Share
From Select you have to start Result with an extra parameter, like this:
Intent intent = new Intent(this,Result.class);intent.putExtra("STYLE",1); //1 means you pressed the first button, 2 means second button etc.startActivity(intent);In Result, you have to get this extra in onCreate
int extra = getIntent().getIntExtra("STYLE",0);and build the layout dinamically:
if(extra == 1){// build style one} else if(extra == 2) { ... }…