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
+ 1

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
4 Answers
+ 3
For going to another activity, just define setOnClickListener event on a button in FirstActivity inside onCreate Method. Ex- Button newButton=(Button)findViewById(R.id.btn1); newButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(FirstActivity.this,SecondActivity.class); startActivity(intent); } });
26th Jan 2017, 12:13 PM
gunjan maheshwari
gunjan maheshwari - avatar
+ 2
You're welcome, I am a beginner too. If you want to get a overview then go through android tutorials in YouTube and practice. You can check this out- Android App Development for Beginners Playlist: https://www.youtube.com/playlist?list=PL6gx4Cwl9DGBsvRxJJOzG4r4k_zLKrnxl
26th Jan 2017, 5:10 PM
gunjan maheshwari
gunjan maheshwari - avatar
+ 1
thank you I'm beginner's android developer can you help me ??
26th Jan 2017, 4:48 PM
Mohammed Elhafed Messini
Mohammed Elhafed Messini - avatar
+ 1
thanks again if i need anything I will tell you ok 😊
26th Jan 2017, 5:15 PM
Mohammed Elhafed Messini
Mohammed Elhafed Messini - avatar