• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best way to start a new activity

 
Don Scott
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am developing a map program where I want a user to click on a button and then more information will pop up with information or a dialer. I know I can just start an activity-which is the quickest way it seems. However, should it be a different class-an Intent or subclass of Activity. I want to be able to go back to the main program easily-if seems I can't do that after an activity as easily as I hoped.

Thanks for any help!
 
Ed Burnette
Author
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll create a subclass of Activity, and create your new user interface screen there.

To cause the Activity to start you'll create an instance of Intent, filling it in with any parameters. Then you'll either tell Android the exact class to start (if you know it), or ask Android to search for somebody that can fulfill the request (if you don't know it or you want to let other developers replace the Activity that will be called).

For more info see these book sections:
Section 2.3, Building Blocks
Section 3.5, Implementing an About Box
Section 4.2, Starting the Game

and this on-line documentation:
http://developer.android.com/guide/topics/intents/intents-filters.html
http://developer.android.com/reference/android/content/Intent.html
http://developer.android.com/reference/android/app/Activity.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic