I am new to Android App Development. I am trying to build an interactive app where there are two screens. On the first screen there will be a button. When the button is touched, then another screen will appear. I have already made the first screen. But how do I link the second screen to the first screen? Please help.
Asked
Active
Viewed 73 times
-4
-
1This is literally what the official "getting started" discusses. https://developer.android.com/training/basics/firstapp/index.html – OneCricketeer Dec 07 '16 at 06:24
-
2And please use the search -- [How to start new activity on button click](http://stackoverflow.com/questions/4186021/how-to-start-new-activity-on-button-click) – OneCricketeer Dec 07 '16 at 06:26
-
Thanks a lot cricket_007!! That solved my problem. – Sh4dy Dec 07 '16 at 07:08
2 Answers
0
Make the second screen a new Activity, and in the buttons onClick method put this to switch to the second activity.
Intent intent = new Intent(this, NewScreenActivityName.class);
startActivity(intent);

Nick Friskel
- 2,369
- 2
- 20
- 33
-1
It can be done by simply using Intent Object
Intent intent=new Intent(this,SecondActivityName.class);
startActivity(intent);
Please learn what are Intent. There are many tutorial online

FaisalAhmed
- 3,469
- 7
- 46
- 76