In this Tutorial we will discuss switching between activities in Android. We are going to use Android Intent and OnClickListener in this tutorial. We are going to create two Activities “Activity1″ and “Activity2″ and switch between them on Button Click.
Create new project in eclipse by selecting File -> New -> Android Application Project. Give a Application name, Project name and Package name. Here my package name is learn2crack.switchactivity. In the next step enter the Activity name and Layout name. Here I created the main Activity as Activity1 and main Layout as layout1.
Layout 1- layout1.xml
Layout 1 has a Text View which shows the current activity and a button to switch to Activity 2.