• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps New Menu Java needed?

co500

Newbie
Right, Im hoping someone can help me out on this.

I have an application I'm making and so far everything is working great, I have a splash screen then a main.xml with button activities leading to different xmls with information on it, so lets say I click a button activity on the main.xml which takes me to page.xml with info on it, there is another button activity on page.xml that I want it go to a new xml called page2.xml but I have no idea how to do that.

Do I need to create another menu.java like class for that page?

If anyone knows how to or there is a video tut how to I'd be so thankful :)

I hope I explained well :P
 
I dont understand your problem, as you are not using the correct terms for Android development, such as activities, option menus, etc... if you use the correct terms and be consistent with the ones you use, then we can better understand you, and ultimately better understand you.
 
I dont understand your problem, as you are not using the correct terms for Android development, such as activities, option menus, etc... if you use the correct terms and be consistent with the ones you use, then we can better understand you, and ultimately better understand you.

Sorry, Im fairly new to android development I have changed my first post so hopefully you can make more sense out of it, I'd like it if you posted back so that I could further improve on my OP :)
 
What is your menu.xml?

in Android, every "screen" is called an activity, and your class for an activity's GUI is a subclass of the Activity class. each activity subclass must also be referenced in the manifest with the <activity ...> and </activity> tags. Lastly, to move Frome one activity to another, you would use something like:

Code:
Intent I = new Intent(CurrentActivitySubclassName.this,   ActivitySubclassToStartName.class);
startActivity(I);
 
What is your menu.xml?

in Android, every "screen" is called an activity, and your class for an activity's GUI is a subclass of the Activity class. each activity subclass must also be referenced in the manifest with the <activity ...> and </activity> tags. Lastly, to move Frome one activity to another, you would use something like:

Code:
Intent I = new Intent(CurrentActivitySubclassName.this,   ActivitySubclassToStartName.class);
startActivity(I);

So if I go from the main.xml to a new activity through a button then on that activity I would use that code on the button there to lead me to a new activity (all set up, of course)

wait, would the code go in manifest file or the .java one?
 
So if I go from the main.xml to a new activity through a button then on that activity I would use that code on the button there to lead me to a new activity (all set up, of course)

wait, would the code go in manifest file or the .java one?

Everything in java, and subsequently Android, is event driven, so that code I posted previously would be placed in a java file inside some event handler (onClick, onTouch, etc...).

You sound like you are already successfully going from one activity to another. What code do you have for that?
 
Everything in java, and subsequently Android, is event driven, so that code I posted previously would be placed in a java file inside some event handler (onClick, onTouch, etc...).

You sound like you are already successfully going from one activity to another. What code do you have for that?

That is correct! From my main activity (which is the one that opens when I launch the app) goes to a activity called basics

Code:
public class menu extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
		ImageButton information = (ImageButton) findViewById(R.id.basics);
		information.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				startActivity(new Intent("com.co500.craftbook.BASICS"));
			}
		});

This is fully working and what I want to know is how to get from the basics activity to a new activity through the use of a image button
 
That is correct! From my main activity (which is the one that opens when I launch the app) goes to a activity called basics

Code:
public class menu extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
		ImageButton information = (ImageButton) findViewById(R.id.basics);
		information.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				startActivity(new Intent("com.co500.craftbook.BASICS"));
			}
		});

This is fully working and what I want to know is how to get from the basics activity to a new activity through the use of a image button

You do it the same way you went from your splash screen to the BASICS activity.
 
You do it the same way you went from your splash screen to the BASICS activity.

That wasnt the splash screen it as the main.xml to the next activity, I don't really understand what you mean?

Did you mean "You do it the same way you went from your splash screen to the MAIN activity."?
 
Every Activity's layout is marked up in XML. main.xml is the layout for your Activity. For every other activity, you need another XML and another subclass of Activity that uses that XML.
 
Does anyone know any good tutorials (preferably youtube ones) that are good for learning how to develop for android, or even books?
 
Back
Top Bottom