1

我有一个应用程序,我已经开发了大约 6 个月。它在某些屏幕上使用选项菜单。在我将 eclipse 从 api ~14 更新到 17 之前,它一直有效。我也更新了工具。

选项菜单不再存在,谁能告诉我为什么?在 api 17 中有什么我必须做的不同的事情吗?

这是将用户登录到应用程序的选项菜单。

@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");


            .........
4

1 回答 1

1

我有同样的问题,也许尝试再次编译 api 级别 11。在 api 17 中,某些设备没有硬件按钮,这可能会造成混乱。

于 2013-03-05T12:53:04.183 回答