enter image description here

Hi there, everything i click on my fragment. It adds a menu button to action bar . So if i click it 3 times. It adds the menu button 3 times..

Does anyone know where went wrong???

This is my code

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent i = null;
    switch (item.getItemId()) {
    case R.id.refresher:

        i = new Intent(this.context, CameraInfoActivity.class);

        startActivity(i);

        return true;

    case R.id.settings:

        return true;

    default:
        return super.onOptionsItemSelected(item);
    }
}

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    // TODO Auto-generated method stub
    super.onCreateOptionsMenu(menu, inflater);
    inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.menu_indoor, menu);

}

and i added

    setHasOptionsMenu(true);

at my OnCreateView .

Related posts

Recent Viewed