Android SharedPreferences set True or False - Clear on App Exit

Posted by KickingLettuce on Stack Overflow See other posts from Stack Overflow or by KickingLettuce
Published on 2012-10-19T22:41:22Z Indexed on 2012/10/19 23:01 UTC
Read the original article Hit count: 189

Filed under:
|

I want a notification to pop up when an app opens. But once User dismisses, I don't want it to come back again, even if they go back to the same activity. But when the app exits, and they come back later, I want same dialog notification to pop up (prompting user to login).

So basically...

boolean b = true;

if (b == true) {
     // show dialog
     b = false;
} 

I simply want var b to save state but clear on exit.

© Stack Overflow or respective owner

Related posts about android

Related posts about sharedpreferences