Yogesh Legendkiller February 2016

How to identify values changed in sharedpreferences?

Here i have one doubt this would be very dumb question but am struggling with this am having one login activity and list activity in login activity it will communicate with remote server and will get json response from server for example will get userid which i'l save it in sharedpreference and will pass that value in listactivity for detail list till this is everything is fine but my doubt is when new user login i need to send null to url in listactivity from next time il get time from response based on that response will be altered for that how can i check the value in sharedprefrence whether its a first time or already logged in !!

Answers


Adriel Ad February 2016

Just add one more entry in shared preference with any key. On onCreate of your MainActivity check that key, if its false, then update it to true.

So, that way, if you get false then its your first time and if you get true, then its logged in.

Please follow steps in below link

Detect First Run

Post Status

Asked in February 2016
Viewed 2,821 times
Voted 4
Answered 1 times

Search




Leave an answer