Thanks for the advise. I did make a mistake in the subject line. I am attempting to create an OPTIONS menu not a context menu.
With that method and my code, how can I execute the setup.java (class)? Isn't the ".setIntent(new Intent(this, setup.class));" the method to execute the code in the setup.class? What I am attempting to do is create an option menu from the first screen, and if you press an option, it will display another screen where the code for that screen will be executed. Now that screen may have a different option menu as well. I have read other ways to create the options menu and it works if all is within your "main" class however I was unable to create or not display the options menu on the second screen. Hope this helps you clarify what I am looking for. On Sep 24, 5:48 am, JC <[email protected]> wrote: > hello rb, > > You also need to override following method along with > onCreateOptionsMenu(). > > @Override > public boolean onOptionsItemSelected(MenuItem item) { > > } > > HTH > JC > > On Sep 24, 3:42 pm, Brion Emde <[email protected]> wrote: > > > > > You should look at the Contextmenuexamples in this > > article:http://developer.android.com/guide/topics/ui/menus.html > > > You are setting up anOptionsmenu, not a contextmenu. > > > On Sep 23, 7:40 pm, rb <[email protected]> wrote: > > > > Hi, > > > > I am attempting to create a simple contextmenuthat will show another > > > screen and have some functionality. What is happening is that if I > > > selectmenu, I get the items (contextmenu) then when I select one of > > > them, it does nothing. What am I missing here? Once you click on > > > the item, should it not execute the class that you have indicated? > > > > Here's my code: > > > > This is in the main application: > > > package com.calculator; > > > > import android.app.Activity; > > > import android.content.Intent; > > > import android.graphics.Color; > > > import android.os.Bundle; > > > import android.view.View; > > > import android.widget.Button; > > > import android.widget.TextView; > > > > public class Calculator extends Activity { > > > /** Called when the activity is first created. */ > > > @Override > > > public void onCreate(Bundle savedInstanceState) { > > > super.onCreate(savedInstanceState); > > > setContentView(R.layout.main); > > > > ... code of the project .... > > > > // contextmenu > > > public boolean onCreateOptionsMenu(android.view.Menumenu) { > > > super.onCreateOptionsMenu(menu); > > > menu.add("Setup") > > > .setIcon(android.R.drawable.ic_menu_preferences) > > > .setIntent(new Intent(this, setup.class)); > > > menu.add("About") > > > .setIcon(android.R.drawable.ic_menu_info_details) > > > .setIntent(new Intent(this, about.class)); > > > return true; > > > } > > > > } > > > > -------------------------------------------------- > > > > Here's the code for the "setup.java" class. I have created a layout > > > page called "setup.xml". > > > All this should do is show me. > > > > package com.calculator; > > > > import android.app.Activity; > > > import android.os.Bundle; > > > import android.widget.Toast; > > > > public class setup extends Activity { > > > > �...@override > > > public void onCreate(Bundle savedInstanceState) { > > > super.onCreate(savedInstanceState); > > > setContentView(R.layout.setup); > > > } > > > > } > > > > -------------------------------------------------- > > > > I have placed the setContentView(R.layout.setup); in the main and used > > > different coding for context menus and it did show me the other > > > screen, but if I selectmenu, it gives me the same contextmenu. I > > > figure that the above code would direct me to the individual class > > > where you can code it specifically and show what you want. Any ideas > > > on what I am missing here? Please forgive me as I am new to this. > > > Any complete code would be appreciated. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

