androidapioptions-menu

optionsmenu not working since updating eclipse with sdkmanager


I've an app that i've been developing for around 6 months. It uses an options menu on some of the screens. It has always worked until i updated eclipse from api ~14 to 17. I also updated the tools as well.

The options menu is no longer present can anyone tell me why? Is there something i have to do differently in api 17?

Here's the optionsmenu that logs the user into the app.

@Override
    public boolean onCreateOptionsMenu(Menu menu) {

        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.layout.menuentryoptionsmenu, menu);

        if(isAllowChangeUser.equalsIgnoreCase("false")){
            MenuItem mi = menu.findItem(R.id.changeuser);
            mi.setVisible(false);
        }
        return true;

    }



    @Override
    public boolean onOptionsItemSelected(MenuItem item) {

        Cursor allFromCompIdTable = nfcscannerapplication.loginValidate.queryAllFromCompanyIdTable();

        if(allFromCompIdTable.getCount() > 0){

            if(allFromCompIdTable.moveToLast()){

                compId = allFromCompIdTable.getString(allFromCompIdTable
                        .getColumnIndex(LoginValidate.C_COMPANY_ID_OUTSIDE_APP_PURPOSES));

            }

        } 

        if(isAllowChangeUser.equalsIgnoreCase("false")){
            if(item.getItemId() == R.id.changeuser)
            item.setVisible(false);
            }

       switch (item.getItemId()) {


        case R.id.login:

            //if(gpsStatusStopped == true){

                Log.e(TAG, "gps engine has stopped now");


            .........

Solution

  • I had same problem, maybe try to compile agains api level 11. in api 17 there are some unconvienced features with some device without hardware buttons, this could do the mess.