Saturday, January 28, 2012

An easy way to add a new Activity in an Android application when using Eclipse

Adding an Activity in an Android application is very simple and straight forward. Activity classes can be created by extending class and overriding each methods manually. If you do not want to type in all these code manually, there is an easy way to create new Activity when using Eclipse. Eclipse UI provides a very easy and fast way to create new activities.The generated class can also have the code that overrides all the methods from the Activity class, already inserted for you. Here is how we do it.

Step 1) Open the AndroidManifest.xml

Step 2) Click on the "Application" tab

Step 3) In the Application Nodes section, click on "Add..." and select the "Create a new element at the top level, in Application" and select "Activity" and click "OK"

Step 4) Select the activity and click on the "Name*" hyperlink and enter the name and other details for the new class and click "Finish". You are all set with the new Activity class

Blog Archive