/ Published in: Java
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
SharedPreferences prefs = getApplicationContext().getSharedPreferences("YourAppName", 0);
// YourAppName is just a string to identify the prefs. 0 means other apps can't see your prefs.
prefs.getString("lastUrl", ""); // get out a string called 'lastUrl'. "" is the return value if the preference doesn't exist
// To change values you need an 'Editor'
Editor edit = prefs.edit();
edit.putString("lastUrl", "http://www.example.com" ); // save the value..
// could make multiple changes here.
if (!edit.commit()) {
Log.e("FOO", "Failed to save prefs");
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                