0

I created menu in my activity. i can see the menu in 2.X version but i cant able to see the menu in 4.x version android phone what i did wrong. i tried bellow things listview as action overflow in sherlock actionbar, ActionBarSherlock, ActionBar and Native menu, how to proceed?, https://stackoverflow.com/questions/17930664/unable-to-show-the-3-dotted-menu-in-overflow-sherlockactionbar,https://stackoverflow.com/questions/9286822/how-to-force-use-of-overflow-menu-on-devices-with-menu-button/11438245#11438245

 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
    // TODO Auto-generated method stub

    android.view.MenuInflater inflater = getMenuInflater();

    getSherlock().getMenuInflater().inflate(R.menu.main, menu);

    return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    switch (item.getItemId()) {
    case R.id.close_tab:
         TabHost tabHost = AllFriendList.self.getTabHost();
            int position = tabHost.getCurrentTab();
            Log.d("Position",Integer.toString(position));
            Log.d("Z val in delete()",Integer.toString(z));
            if(position >0)
            {
            tabHost.getCurrentTabView().setVisibility(View.GONE);
            tabHost.setCurrentTab(position+1);
            z-=1;
            if(z<0)
            z=0;
            }
            else if(position == 0)
            {
            tabHost.getCurrentTabView().setVisibility(View.GONE);
            tabHost.setCurrentTab(position+1);
            z=0;
            }
            else if(position == z)
            {
            tabHost.getCurrentTabView().setVisibility(View.GONE);
            tabHost.setCurrentTab(z-1);
            Log.d("Z value in final","lol");
            Log.d("Pos",Integer.toString(position));
            Log.d("z pos",Integer.toString(z));

        }
            TabActivity parent = (TabActivity) getParent();
            TabHost tabhost = parent.getTabHost();
            tabhost.setCurrentTab(z+1);
        return true;
        default: 
        return true;
    }   
}

Can any one help me Thanks

Community
  • 1
  • 1

1 Answers1

0

Add break in your switch statement.

Siddharth_Vyas
  • 9,972
  • 10
  • 39
  • 69