Android Tutorial for Beginners – How to Start New Activity On Button Click via Intent




In this tutorial we will learn How to Start New Activity On Button Click via Intent

 

Step 1 – Create new Android project

Step 2 – Add a button to main activity (layout/activity_main.xml) using designer.

 

Step 3 Add the new activity . Right Click Project -> New -> Activity -> Blank Activity

Give the name to your activity  SecondActivity

 

create blank activity
create blank activity

 

Change the background color of SecondActivity if you wish.

 

write the following code

src/main/AndroidManifest.xml

 

layout/activity_main.xml

 

layout/activity_second.xml

 

com/example/programmingknowledge/thefirstapp/MainActivity.java

 

com/example/programmingknowledge/thefirstapp/SecondActivity.java

 

OUTPUT:

layout/activity_main.xml
layout/activity_main.xml
layout/activity_second.xml
layout/activity_second.xml

 

Download Project File

 

 

 

 

 

 

 

 

 

 

 


Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


  • Huzefa Vakhariya

    Hello Sir, I have started learning Android Programming from your great and very interesting videos. Now I want to make an app in which i can store time and date from internet i.e. from online server in database table using PHP. So can you make its video or help me in it by showing code and guiding me how to implement that code in Android Studio for making it execute perfectly.´╗┐ I will be thankful to you if you help me in this task. Your great fan, Huzefa Vakhariya.