How to add activity into android application

We can add more than one activity in our android application. There are several steps to add the activity in the application that are as follows:

  • Go to project explorer.
  • Now select the project and press right click.
  • Now select New=> Other
  • android

  • When we click on Other button then select wizard will open as follows:
  • android

  • Now we have to expand the Android then select the one type of activity that we want to add.
  • android

  • Now click on Next button, now create activity wizard will open and this wizard have the several options.
  • This dialog box is as follows:
  • android

  • Now we have to select the activity type and click on Next button, now we have to change the name of activity because by default MainActivity is written in the activity name field.
  • In android, all the activity has the unique name so we have to provide the name for the activity.
  • android

  • Here we have to change the name of activity.
  • android

  • Now click on the Finish button. Now the activity is created as shown in the package explorer.
  • In the package explorer, we can see the newly created java file and the newly created xml layout file.
  • android

We can add the any kind of activity in our application according to the need. These various types of activities can be blank activity, Fullscreen activity, Login Activity, Master/Detail flow or Settings Activity.

In this demo, we have used Blank Activity.