am creating a method whereby option view alternates depending on the users input: For e.g:
1.)when user selects login option, and after user has logged into the app, the option will change to logout
2.) Before login, "User Profile" is displayed as an option, after the user has logged in, "" will be displayed in place of "user profile"
However, the following codes that I have input doesn't facilitate in the change in status. The options are menu titles in the drawerlist. Could anyone please help.
Code:
//Case 2:
/* Condition to check if user is login, user is login, title will display LogOut, else
* will display "Login"*
*/
if (isLogin= true)
title = "Logout";
else
title = "Login";
icon = R.drawable.google_icon;
mAdapter.addItem(title, icon);
case 2:
//alternation of login/logout options, login to change to logout when user is login and vice versa
if (isLogin == false){
Intent intent = new Intent(getApplicationContext(),
ChannelAppLoginInfoMainActivity.class);
startActivity(intent);
}else{
logoutChannelApp();
}
break;
Aucun commentaire:
Enregistrer un commentaire