Exam4Training

Which of the following is NOT true about the SharedPreferences interface?

Which of the following is NOT true about the SharedPreferences interface?
A . The data it saves is persistent even if application is killed.
B . It only saves primitive data in key-value pairs.
C . Modifications to preferences saved should go through class SharedPreferences.Editor
D . It can save any data type in key-value pairs.

Answer: D

Explanation:

SharedPreferences class is an 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.

References: http://developer.android.com/reference/android/content/SharedPreferences.html

Latest AND-401 Dumps Valid Version with 228 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Exit mobile version