Chris Brookes
Chris Brookes

Reputation: 35

Using Intents to switch between classes

I have a 'home page' on my app with a button in. I have implemented an onClickListener. I want to change to a different class when clicking the button. (Navigating to another page within the app with a different XML file) What am I doing wrong??

Intent myIntent = new Intent(this, menu_two.class);
         startActivity(myIntent);

That is in the code which goes in a switch statement which identifies which button has been pressed. I am not using an XML file, layout hard coded straight from java.

Home I have given you enough information to help

thanks

Upvotes: 0

Views: 586

Answers (1)

Cristian
Cristian

Reputation: 200080

First, make sure that menu_two is an activity. If you are not using an XML, that shouldn't be a problem. Also, verify that you added menu_two to your AndroidManifest.xml file, where you must register all activities that your app uses.

Upvotes: 2

Related Questions