Correct Answer : Get Lastest Questions and Answer : Explanation: Interface for accessing and modifying preference data returned by getSharedPreferences(String, int). For any particular set of preferences, there is a single instance of this class that all clients share. Modifications to the preferences must go through an SharedPreferences.Editor object to ensure the preference values remain in a consistent state and control when they are committed to storage. Objects that are returned from the various get methods must be treated as immutable by the application.
Note: currently this class does not support use across multiple processes. This will be added later To obtain shared preferences, use the following method In your activity:
SharedPreferences prefs = this.getSharedPreferences( "com.example.app", Context.MODE_PRIVATE); To read preferences:
String dateTimeKey = "com.example.app.datetime";
// use a default value using new Date() long l = prefs.getLong(dateTimeKey, new Date().getTime()); To edit and save preferences
Date dt = getSomeDate(); prefs.edit().putLong(dateTimeKey, dt.getTime()).apply(); The android sdk's sample directory contains an example of retrieving and storing shared preferences. Its located in the:
4. Since Android uses libraries licensed in various ways such as GPL, BSD, and LGPL, applications developed under Android are subject to the severest license, GPL