Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old May 16th, 2010, 01:41 PM   #1 (permalink)
Junior Member
 
Join Date: May 2010
Posts: 15
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default Activity vs Layout

I couldn't find any discussion about this anywhere. Just wondering what the 'best practice is'.

I am making a little game - it has 4 pretty standard screens

1. Main menu
2. Game screen
3. Help screen
4. Hi scores screen

So my question is - which is the best approach.

1. Make each screen a separate activity and launch each one from the main menu activity

2. Make each screen a layout and change setContentView in the main activity


I guess a lot rests on the best practice for these things. Like - if you hit the back button on your android device, should a game exit completely, or should it return to the main menu first..so you have to press back twice to exit?

safibaba is offline  
Reply With Quote
Sponsors
Old May 16th, 2010, 08:03 PM   #2 (permalink)
Junior Member
 
Join Date: Apr 2010
Posts: 85
 
Device(s):
Thanks: 0
Thanked 16 Times in 15 Posts
Default

I would say to encapsulate the classes better you would want to make each a separate activity. Otherwise you're going to have to handle all those functions in one class, not to mention handling all the states statically if the user changes the phone orientation. Better to go with the separate activities...
Boogs is offline  
Reply With Quote
Old May 17th, 2010, 06:57 AM   #3 (permalink)
Junior Member
 
Join Date: May 2010
Posts: 15
 
Device(s):
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the advice Boogs. I will go that route then.

I notice that if you call a sub activity, it doesn't get listed separately in the running processes - so that's good. I guess only applications get listed.
safibaba is offline  
Reply With Quote
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making an adroid activity as the default activity? nackasha Application Development 2 January 4th, 2011 12:39 AM
Layout Help!! Adamsklan Developer 101 2 August 20th, 2010 01:17 PM
Finish activity from another activity Tollas Application Development 0 July 2nd, 2010 04:22 PM
Layout dkaufman1 Suggestion Box & Feedback 0 April 13th, 2009 10:11 AM
Layout Sivan Suggestion Box & Feedback 7 October 29th, 2008 09:50 AM



All times are GMT -5. The time now is 02:43 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo