0
It’s not working my sharedPreferences.
public static final String PREF_NAME = "TelaApresentacaoActivityPreferences";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_screen_slide);
mPager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new ScreenSlidePagerAdapter(getFragmentManager());
mPager.setAdapter(mPagerAdapter);
mPager.setOnPageChangeListener(newViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
invalidateOptionsMenu();
}
});
sharedPreferences = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
}
@Override
protected void onStop() {
super.onStop();
sharedPreferences = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.commit();
}
@Override
protected void onDestroy() {
super.onDestroy();
sharedPreferences = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.clear();
editor.commit();
}
On my Androidmanifest.xml, I put chunks of code inside
android:onHistory="true"
What’s not working out?
– user28595
when I close application and open it again it appears to Activityapresentacao.
– Douglas William
Explain what you’re trying to do.
– ramaral
In my app I have a Screen Slide, I want to run only once, when user will close the application it is not visible to user again, as well as login too.
– Douglas William