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


Go Back   Android Forums > Android Development > Application Development > Developer 101

Developer 101 101 Tutorials



Reply
 
LinkBack Thread Tools
Old February 11th, 2012, 04:37 PM   #1 (permalink)
New Member
 
Join Date: Feb 2012
Posts: 3
 
Device(s):
Thanks: 1
Thanked 0 Times in 0 Posts
Default Easy menu question

Hi all,

I'm new to android development and I want to create a menu for my app. The problem is that when I search for instructions, they all want to talk about what to do when the user presses the menu button which is not what I'm looking for.

Here's a pic to show what I'm trying to do. The user would load my app and be presented with something pretty much identical to this.

Menu.jpg

I have one of the three parts coded and working just fine, but in the end I want the user to choose between the three options instead of stacking the three parts vertically on one screen.

How can I accomplish this? Or where can I go to find this info?

Thanks!

louched1 is offline  
Reply With Quote
Sponsors
Old February 11th, 2012, 05:24 PM   #2 (permalink)
Premium Member
 
Join Date: Oct 2011
Location: Sydney, Australia
Posts: 193
 
Device(s): Galaxy Nexus GSM
Thanks: 2
Thanked 37 Times in 33 Posts
Default

Does this thread help you?
jiminaus is offline  
Reply With Quote
Old February 11th, 2012, 06:21 PM   #3 (permalink)
New Member
 
Join Date: Feb 2012
Posts: 3
 
Device(s):
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks jiminaus, but that's not what I'm looking for. The code solution posted for them is a step behind where I'm at. I can create that menu. I'm trying to make that menu switch to a new screen when one of the buttons is pushed.

I can create a menu in the main.xml file. I can make onClick methods that tell those buttons to do stuff. What I'm looking for is how android handles a screen switch once a menu option has been selected. I'm currently stuck with one screen for the user (main.xml) and I don't want to stack everything on one screen.

Does this involve multiple xml files? Where does these xml files go? How do I reference it them to make the switch between screens? Does each new screen need it's own class? Things like that.

I'm certain there's documentation on this somewhere as it's an extremely basic. I'm just having troubles finding said documentation because of the overlapping terminology. Searching for menu tutorials brings up how to handle the user pressing the menu button. Searching for multiple screens brings up how to support different phone screen sizes.

Maybe the picture below will clear up what I'm trying to do?

MainMenu.jpg
louched1 is offline  
Last edited by louched1; February 11th, 2012 at 06:28 PM.
Reply With Quote
Old February 11th, 2012, 07:16 PM   #4 (permalink)
Senior Member
 
Join Date: Jul 2010
Posts: 977
 
Device(s): Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Thanks: 52
Thanked 199 Times in 144 Posts
Default

so you just want to start a new activity when the user presses one of the buttons?

In that case, when the user presses a button, you can start a new activity like so:

Code:
startActivity(new Intent(NameOfStartActivity.this, NameOfNewActivity.class);
To dertermine exactly which activity to launch, just use a switch statement (or series of conditionals depending on your onClick implementation).
jonbonazza is online now  
Reply With Quote
The Following User Says Thank You to jonbonazza For This Useful Post:
louched1 (February 11th, 2012)
Old February 11th, 2012, 08:15 PM   #5 (permalink)
New Member
 
Join Date: Feb 2012
Posts: 3
 
Device(s):
Thanks: 1
Thanked 0 Times in 0 Posts
Default

"new activity" is the phrase I was looking for! Thanks, I can take it from here.

EDIT: And it's working. Thanks much!
louched1 is offline  
Last edited by louched1; February 11th, 2012 at 08:28 PM.
Reply With Quote
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development > Developer 101 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




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