有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何在登录后隐藏主活动上的项目?

我有两项活动。主要活动和登录活动。我在主活动中已经有一堆代码,当int值设置为特定数字时,这些代码被编程为隐藏项目。但问题是,在我登录后,它应该在发送新的int值后隐藏所有项目,我如何才能做到这一点

在这种情况下,在我以UserAccount 1登录后,它应该隐藏menuItem\u manage\u geofence,我该怎么做呢

这是我用来从导航抽屉调用Login类的方法

                    Intent loginActivityIntent= new Intent(getApplicationContext(), LoginActivity.class);                     
                    startActivity(loginActivityIntent);

还有我隐藏物品的if方法

    if (UserAccountType == 0) {
        menuItem_manage_geofence.setVisible(false);
        menuItem_login_out.setVisible(false);
        menuItem_acccount_management.setVisible(false);
    }

    if (UserAccountType == 1) {
        menuItem_login_in.setVisible(false);
        menuItem_manage_geofence.setVisible(false);
    }

    if (UserAccountType == 2) {
        menuItem_login_in.setVisible(false);
        menuItem_manage_geofence.setVisible(true);
    }

    if (UserAccountType == 9) {
        Log.d(TAG, ehc.error_debug_mode);
        Toast.makeText(this, ehc.error_debug_mode, Toast.LENGTH_LONG).show();
    }

共 (0) 个答案