0

So this is the xml file structure:sfsafsadfsdfasdfasdfasdfasdfsdfsd

 <item...>
    <menu>
       <item>
       </item>
       <item>
       </item>
       <item>
       </item>
   </menu>
  </item>

1 Answers1

0

Try this..

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;
}



 @Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        //do your stuff here..
        return true;
    } 
    return super.onOptionsItemSelected(item);
}
Sjd
  • 1,261
  • 1
  • 12
  • 11