2011-05-09 3 views

Répondre

4

Pour enregistrer les détails après l'enregistrement de l'utilisateur (lorsque l'utilisateur est créé) ...

// Get the app's shared preferences 
SharedPreferences login_app_preferences = context.getSharedPreferences("LOGIN_DETAILS", MODE_PRIVATE); 

// Update fields 
SharedPreferences.Editor editor = login_app_preferences.edit(); 
editor.putString("email", strEmailOrLoginId); 
editor.putString("password", strPassword); 
editor.commit(); // Very important 

Pour y accéder où dans l'application ....

// Get the app's shared preferences 
SharedPreferences login_app_preferences = context.getSharedPreferences("LOGIN_DETAILS", MODE_PRIVATE); 

strUserName = login_app_preferences.getString("email", ""); 
strPassword = login_app_preferences.getString("password", ""); 
Questions connexes