-2

In my Android app, the login system should save data, so that it shows the "data/information " in ANOTHER classes.

My login contains: weight, height, age, name.

Onhar
  • 5
  • 6

1 Answers1

0

use shared preferences

Save values

   SharedPreferences sharedpreferences = getSharedPreferences("YourPreferenceName", Context.MODE_PRIVATE);  

Editor editor = sharedpreferences.edit();
editor.putString("weight", "value");
editor.commit();

Get Values

SharedPreferences sharedpreferences = getSharedPreferences("YourPreferenceName", Context.MODE_PRIVATE);

String weight = sharedpreferences.getString("weight", "default_value");
KDeogharkar
  • 10,939
  • 7
  • 51
  • 95
  • And you do I get in the next activity – Onhar Jun 15 '16 at 11:26
  • But.... If the user quits the app and opens it again, does those values stay the same? Example: if I had one-time login and next time when user comes and skips the login, are the register values same as the user set on the first time? – Onhar Jun 16 '16 at 17:26