i'm trying to show an activity (introduction activity
) appears only once this activity
contains one Button
(Skip), when user click in skip button
MainActivity
will showing so for that i use SharedPreference
when i run my app on android 6.0 or 7.0 works fine but when i run it on android 5.0.1 ( Samsung S4 ) the skip button
works but not in a smooth way he keep stuck for a while(3 or 4 seconds ) .
Logcat :
java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.android.settings/com.android.settings.applications.InstalledAppDetails}
Intro Activity :
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.introactivity);
skip = (Button)findViewById(R.id.skip);
hide();
appPreferences = PreferenceManager.getDefaultSharedPreferences(this);
skip.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = appPreferences.edit();
editor.putBoolean("introSkipped", true);
editor.apply();
finish();
}
});
}
MainActivity :
SharedPreferences appPreferences = PreferenceManager.getDefaultSharedPreferences(this);
if (!appPreferences.getBoolean("introSkipped", false)) {
Intent toIntro = new Intent(this, introactivity.class);
startActivity(toIntro);
}