-1

I would like to have the user stay log in even when app is killed and reopened after logging in once.

I have login java page, a click and logout function in another page.

How do I use sharedpreferences to get the result I wanted?

As far as I know, sharedpreferences is only usable within one java page.

.

.

Thanks for any suggestions or sample will be nice.

  • 1
    please understand http://stackoverflow.com/questions/23024831/android-shared-preferences-example – J.K Jan 04 '15 at 16:15

1 Answers1

0

Try this- when u login set sharedpreference value

eg editor.putBoolean("key_name1", true);

on clicking logout button make it false

eg editor.putBoolean("key_name1", false);

everytime your launch activity loads (you start your app) check the value of the sharedpreference

if the value is true user is logged in otherwise logged out

Remees M Syde
  • 2,564
  • 1
  • 19
  • 42
Carbon
  • 133
  • 1
  • 4
  • 21