pref is uninitialised/ null when you do this and hence editor is set to null.
Editor editor = prefs.edit();
so moving your editor initialization to constructor after you initialise prefs
should help
Change this:
private SharedPreferences prefs;
Editor editor = prefs.edit();
public Session(Context cntx) {
// TODO Auto-generated constructor stub
prefs = PreferenceManager.getDefaultSharedPreferences(cntx);
}
to
private SharedPreferences prefs;
Editor editor;
public Session(Context cntx) {
// TODO Auto-generated constructor stub
prefs = PreferenceManager.getDefaultSharedPreferences(cntx);
editor = prefs.edit();
}