what is the purpose of getExtras()?
It doesn't really do anything useful. Seriously.
In the Preference
source code, there is a private
member variable mExtras
:
private Bundle mExtras;
However, it's never changed in any way (and cannot be accessed by outside classes whatsoever), except in the following:
public Bundle getExtras() {
if (mExtras == null) {
mExtras = new Bundle();
}
return mExtras;
}
public Bundle peekExtras() {
return mExtras;
}
I suppose it might be used for something in the future, but it was added in API 11 and remains useless through API 16.
There is no method putExtra/s() in the Preference class, then... In which scenrarios is it used?
I guess you could use it for associating items with a preference, like:
Bundle extras = myPref.getExtras();
extras.putString("KEY", "Value");
You don't need putExtra()
to do so, instead accessing the Bundle
directly. But that's about all it's useful for, it seems.