android - How to Store and Access CheckBox value after activity closed and Open in Java? -
i making simple android project. when open app show dialog message. dialog have 1 check box function don't show again.
how this?
how save value on local , access it?
save value when checkbox checked
sharedpreferences prefs = preferencemanager.getdefaultsharedpreferences(getbasecontext()); prefs.edit().putboolean("checked",true).apply();
for validation
sharedpreferences prefs = preferencemanager.getdefaultsharedpreferences(getbasecontext()); boolean checked = prefs.getboolean("checked", false); if (checked){ //do not show } else{ //show }
Comments
Post a Comment