java - Sharing a variable between many Activities in Android App -


I am giving my user login to Facebook, Twitter and G + on my app. After they log in, I want to know that they are logged in to every activity in my app. I want to find a way to find it on every activity. I know that you use activity in this way You can parse by:

  intent = intent (new activity), main activity. Intent.putExtra ("Login Mode", "Facebook"); StartActivity;  

But is there a problem with doing 10+ activities? Is there any easy way?

Which I want you to implement shared priorities ... are going on this By the way

  shared preferences = priority manager .get defaults shared context (getApplicationContext ()); SharedPreferences.Editor Editor = preferences.edit (); Editor.putstring ("loginMethod", "Facebook"); Editor.commit;  

And whenever you want to check the login mode, call the priority value ...

  Shared Preferences = Preference Manager .get defaults shared context (getApplicationContext ()); String login mode = values ​​= preferences.getString ("loginMethod", "");  

If you need more help then I would be happy to help you.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -