Which data type can be stored using shared preferences?
-
Any data type
-
Primitive data type
-
Advance data type
-
Option (2) and (3)
B
Correct answer
Explanation
SharedPreferences in Android stores key-value pairs where values must be primitive data types: boolean, float, int, long, and String (or Set). Complex objects like custom classes cannot be directly stored - they must be serialized to primitives first.