this is my public class in android!
public class Logout {
public SharedPreferences pref;
public Logout(Context context){
pref = context.getSharedPreferences(LoginActivity.loginpreferences, context.MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
editor.remove(LoginActivity.name_user);
editor.remove(LoginActivity.type_user);
editor.remove(LoginActivity.id_user);
editor.commit();
}
}
to call class when clicking button (logout) I wrote the code in the following way
private OnClickListener clickitempanel = new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int id = v.getId();
switch(id){
case 4:
Logout logout = new Logout(mContext);
// logout.notifyAll();
logout.getClass();
Intent in = new Intent();
in.setClass(mContext, FullscreenActivity.class);
mContext.startActivity(in);
break;
}
}
};
textViewItem.setOnClickListener(clickitempanel);
but doesn't running code remove keys from SharedPreferences !