So I just had to up my min API level to 11 for the Preference (addpreferenceresource was depreciated) – turns out 9-10 takes out like 50% of the market. So my question is, is it better to just suppress the warning to cater to the Gingerbread market or is there a different way to make my preference reference without using Preference Fragments?
Share
I would implement both types (the one that works in 11+ and the one that works in 10-), then use conditional checks for them. This is written in quite a bit of detail in this answer.
Basically, you end up setting up
OtherPreferencesActivitywithPreferenceFragment, and thenPreferencesActivitywith the deprecatedPreferenceActivity. (Your APK will not break by including this deprecated code, as long as you use a version check so that if/when it’s removed in the future, it doesn’t try to find it.)Keep in mind, you will want to have them use each others’ methods as much as possible so that you don’t end up duplicating code.
Last tip:
@TargetApi(11)and@SuppressWarnings("deprecation")will come in handy here. Just be careful that you’re not ignoring other deprecations by doing so.