I'm using the below code in onCreate to display a dropdown menu in the actionbar. The code works fine, it shows the dropdown menu and performs the tasks that i've added in onNavigationItemSelected. But his happens only once i.e if i select Menu Item 2 for the first time the Toast shows "Selected" message and the asynctask is executed. When i reselect Menu Item 2 nothing happens! Why this problem occurs and how can i get rid of this it?
getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
        final LinearLayout mainLayout = (LinearLayout) this
                .findViewById(R.id.linearLayout1);
        ActionBar.OnNavigationListener navigationListener = new OnNavigationListener() {
            @Override
            public boolean onNavigationItemSelected(int itemPosition,
                    long itemId) {
                if (actions[itemPosition].toString().equals("exit")) {
                    System.exit(0);
                }
                if (actions[itemPosition].toString().equals(
                        "Menu Item 2")) {
                    Toast.makeText(getApplicationContext(),"Selected" ,Toast.LENGTH_LONG).show();
                    code="2";
                    //call to an asynctask
                }
                return false;
            }
        };
    getActionBar().setListNavigationCallbacks(adapter, navigationListener);