How to make two activity in android | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make two activity in android

hello , how to make two activity in android and button to go to second activity

25th Jan 2017, 5:22 PM
Mohammed Elhafed Messini
Mohammed Elhafed Messini - avatar
1 Answer
+ 1
First you create a new activity for your project (your app). Then in the onClick() method for your button in the first activity make an Intent object and start the new Activity (I will call it ActivityB in the following code). onClick(View view) { Intent intent = new Intent(this, ActivityB.class); startActivity(intent); }
27th Jan 2017, 8:40 PM
Lorenz Meierhofer
Lorenz Meierhofer - avatar