Files- activity_main.xml(button1,button2), layout1.xml(button3,button4,button5), layout2.xml(button6,button7,button8), layoutA.xml(multiple CheckBox and textView), layoutB.xml(multiple CheckBox and textView), layoutC.xml(multiple CheckBox and textView), layoutD.xml(multiple CheckBox and textView), layoutE.xml(multiple CheckBox and textView), layoutF.xml(multiple CheckBox and textView)
Okay so what I want my app to do is-
Step 1- First Screen activity_main.xml with 2 buttons Step 2- User clicks button1/button2 and http://ift.tt/2osbRYO shows up. Step 3- User clicks any of the 3 buttons in any of the 2 layouts and accordingly layoutA/B/C/D/E/F with checkboxes and textview to show up. Step 4- User clicks Back button and instead of completely exiting the app, roll back only to the previous active layout like layoutA to layout1, layout1 to activity_main,etc.
I have been able to implement the first 2 steps but unable to do the other half.
I would be glad if someone could help me out. Thank You!
This is my MainActivity.java file public class MainActivity extends Activity {
Button button1;
Button button2;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button1 = (Button) findViewById(R.id.button1);
button1.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
setContentView(layout1);
}
});
button2 = (Button) findViewById(R.id.button2);
button2.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
setContentView(R.layout.layout2);
}
});
}
}
Aucun commentaire:
Enregistrer un commentaire