How To Set The Value Of Sharedpreferences In Other Activity?
I have two activities in my app. First activity SplashScreen and other SplashActivity. I have sharedPreferences in SplashScreen but i want to set value of this true in SplashActivi
Solution 1:
May be you are doing something wrong. you can do simply this in splash screen
if(pref.getBoolean("activity_executed", false))
{
Log.v("","Before if called");
setContentView(R.layout.splash_screen);
Log.v("","after if called");
new Handler().postDelayed(csRunnable1, 5000);
pref.edit().putBoolean("activity_executed", true).commit();
}
or in your splashactivity oncreate call this
getSharedPreferences("ActivityPREF", Context.MODE_PRIVATE).edit().putBoolean("activity_executed", true).commit();
Post a Comment for "How To Set The Value Of Sharedpreferences In Other Activity?"