cool you can create SharedPreferences class inside of your package
import java.util.HashMap;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
public class SessionManager {
// Shared Preferences
SharedPreferences pref;
// Editor for Shared preferences
Editor editor;
// Context
Context _context;
// Shared pref mode
int PRIVATE_MODE = 0;
// Sharedpref file name
private static final String PREF_NAME = "stackoverflowreply";
// All Shared Preferences Keys
private static final String IS_CHEKD = "ischekd";
// Constructor
@SuppressLint("CommitPrefEdits")
public SessionManager(Context context) {
this._context = context;
pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
editor = pref.edit();
}
public void createchekdstatus(boolean ischekd) {
// Storing login value as TRUE
editor.putBoolean(IS_CHEKD, ischekd);
// commit changes
editor.commit();
}
public void unchekd() {
// Clearing all data from Shared Preferences
editor.clear();
editor.commit();
}
/**
* Quick check for login
* **/
public boolean getchekdstatus() {
return pref.getBoolean(IS_CHEKD, false);
}
}
then you can store your data in your activity
SessionManager session = new SessionManager(getApplicationContext());
session.createchekdstatus(true);
and then retrive data from SharedPreferences any of ur activity
essionManager session = new SessionManager(getApplicationContext());
boolean chekboxstatus = session.getchekdstatus();
enjoy