I'm confused, please help me.
Android developers documentation say SharedPreferences is an Interface and also we can see on grepCode that the SharedPreferences is an Interface.
But developers.android also says SharedPreferences is a Class.
They write.
"The SharedPreferences class provides a general framework ..."
So, SharedPreferences is a Class or an Interface?
The documentations is not wrong, but may be it is a bit confusing.
If you see the code, you'll see that SharedPreferences is actually an interface. But as you mentioned, here
it is referring to its implementation as class which is actually SharedPreferencesImpl and you can look into its implementation here. When you make a call to getSharedPreferences() method, it actually returns the object of SharedPreferencesImpl which is a class that implements SharedPreferences interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With