To create a new activity, other than the main activity, it is necessary to follow the following steps(in this sequence):
- create a new class that extends Activity
- add it to the Manifest
- create a new layout for it
- if necessary, add new strings to name it.
Create a new Activity
Create a new class by pressing Ctrl+N or by clicking the "class-icon" in eclipse and name is as you want. Make sure you extend it from Activity as shown bellow:
Add it to the manifest file
Locate you Android Manifest file and look for the tab Application. As shown in the picture bellow press add and browse the new class you've created.Creating a new layout
Locate the folder layout, press the icon "new xml file" as shown bellow and add a new layout xml file selecting the type you may need. In my case it was a new xml file with RelativeLayout.Creating new Strings
If you need or want to, you may create some new strings to ensure internationalization. This is up to you. I recommend to do it from the beginning, as i did in this example. The new string can be used in the Manifest file as i did while browsing the new created file as you can see bellow. (See point 4. in the picture bellow)Advertising:
Optimized bets for playing EuroMillion's lottery on your Mobile Phone!








Excellent and very very helpful blog.Thanks a ton for this post.
ReplyDeleteandroid application development