Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8080291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:22:13+00:00 2026-06-05T16:22:13+00:00

I am trying to make a simple Activity which has a menu with two

  • 0

I am trying to make a simple Activity which has a menu with two buttons. The first button will load a separate activity, while the second button I am leaving with nothing to do for now. I have put log statements everywhere but the only one which is executed is the one in onCreateOptionsMenu.

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Set up window View
    setContentView(R.layout.main);

    Log.i( "onCreate", "veryBeginning" );
}

public boolean onCreateOptionsMenu( Menu menu ) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate( R.menu.option_menu, menu );
    Log.i( "onCreateOptionsMenu", "hereasd" );
    return true;
}

public boolean onOptionsSelected( MenuItem item ) {
    Log.i( "onOptionsSelected", "start" );
    switch( item.getItemId() ) {
    case R.id.connect:
        Log.i( "onOptionsSelected" , "r.id.connect" );
        startActivity( new Intent(getApplicationContext(), DeviceList.class ) );
        finish();
        return true;
    case R.id.preferences:
        Log.i( "onOptionsSelected" , "r.id.preferences" );
        return true;
    default:
        Log.i( "onOptionsSelected" , "r.id.?" );
        return super.onContextItemSelected( item );
    }
}

I start the program on my device, open the menu, and click both buttons numerous times, but none of the Logs are showing up in my LogCat.

This is my LogCat

06-13 14:11:34.643: I/onCreate(15262): veryBeginning
06-13 14:11:49.098: W/KeyCharacterMap(15080): No keyboard for id 0
06-13 14:11:49.098: W/KeyCharacterMap(15080): Using default keymap:/system/usr/keychars/qwerty.kcm.bin
06-13 14:11:49.098: I/onCreateOptionsMenu(15080): hereasd
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:22:15+00:00Added an answer on June 5, 2026 at 4:22 pm

    use onOptionsItemSelected(MenuItem item). see here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a real simple app in which clicking a button has
I am trying to make a simple program that could open a new activity
I am fairly new to iOS development and trying make a simple app which
I am trying to develop a simple map application, which will display a map
Trying to make simple minesweeper game in python, but have one problem. I have
I'm trying to make simple website with content background combined from 3 images: top
I am trying to make simple notepad application for learning android development. So, to
I'm trying to make simple script using jquery $post function to pass data to
Trying to make a simple number clicker control for BlackBerry 6/7, like this: At
Trying to make a simple program to catalogue books. Something like this, for example:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.