I am creating session, session is created but when I destroy the app the data which I fetched from SQLite,(like listview) data is become invisible, If I want to see this data, first I logout and login again then this data come. I want SQLite data is also presented in session.
I created session using Shared Preference, session is created because after destroy app is not logout automatically.
public class Session {
SharedPreferences prefs;
SharedPreferences.Editor editor;
Context ctx;
public Session(Context ctx){
this.ctx = ctx;
prefs = ctx.getSharedPreferences("myapp", Context.MODE_PRIVATE);
editor = prefs.edit();
editor.apply();
}
public void setLoggedin(boolean logggedin){
editor.putBoolean("loggedInmode",logggedin);
editor.commit();
}
public boolean loggedin(){
return prefs.getBoolean("loggedInmode", false);
}
There is no error message but SQLite data is not displaying after app destroyed. If I store anything data is not stored after logout and then login I can store and see values what I stored.
from Is there any way to maintain SQLite data with session?
No comments:
Post a Comment