android - Variable loses data when I run another App -
i built variable work session. saving id specific users on log in.
i declaring variable inside sign in asynctask
@override protected void onpostexecute(string result){ if(result == ""){ this.statusfield.settext("wrong password."); }else{ context.startactivity(new intent(context,listusersactivity.class)); session.suserid = result; } } public static class session{ public static string suserid; }
my session class:
public class newsession extends application { session session = new session(); public string getuserid() { return session.suserid; } }
to id user, need call it:
newsession app = (newsession) getapplication(); userid = app.getuserid();
the code working fine, when run google chrome, youtube, or different application, when try run application again, gives me error because session loses value.
is there similar way trying do?
thanks.
the code working fine, when run google chrome, youtube, or different application, when try run application again, gives me error because session loses value.
your process terminated due low memory conditions. perfectly normal.
static data members, including custom application
objects, transient cache. if have data want hang onto, data needs backed persistent data store: database, sharedpreferences
, other form of file, internet, etc.
Comments
Post a Comment