android - Better way of upping my Minimum API Level? -
so had min api level 11 preference (addpreferenceresource depreciated) - turns out 9-10 takes out 50% of market. question is, improve suppress warning cater gingerbread market or there different way create preference reference without using preference fragments?
i implement both types (the 1 works in 11+ , 1 works in 10-), utilize conditional checks them. written in quite bit of detail in this answer.
basically, end setting otherpreferencesactivity
preferencefragment
, , preferencesactivity
deprecated preferenceactivity
. (your apk not break including deprecated code, long utilize version check if/when it's removed in future, doesn't seek find it.)
if (build.version.sdk_int < 11) { startactivity(new intent(this, preferencesactivity.class); } else { startactivity(new intent(this, otherpreferencesactivity.class); }
keep in mind, want have them utilize each others' methods much possible don't end duplicating code.
last tip: @targetapi(11)
, @suppresswarnings("deprecation")
come in handy here. be careful you're not ignoring other deprecations doing so.
android api sdk android-fragments android-preferences
No comments:
Post a Comment