Can I use API level 11 on Android 2.2?

Perhaps a stupid question, but I'm developing for Android 2.2 to 4.1. Can I use this functionality http://developer.android.com/reference/android/preference/PreferenceFragment.html , which is only available from API 11?

or should I use the old http://developer.android.com/reference/android/preference/PreferenceActivity.html , which contains some deprecated methods.

Will the old API work well on Android 4.1?

+4
source share
2 answers

PreferenceFragment will not work with 2.2 and 2.3 (only for API level 11 and above). But you can use the older version. That way, you could just go with the old PreferenceActivity settings - just because they should be avoided, but they usually still work.

Before writing CommonsWare, to offer the best user experience and still support version 2.2, you must implement the two PreferenceActivity classes and then decide at runtime which you need to call. This can be done by checking Build.VERSION.SDK_INT and compare it to "11".

See accepted answer here for implementation: PreferenceActivity Android 4.0 and earlier

+7
source

yes you can use. right click on the project -> select permissions -> click on android -> select any target .. any higher version of google taget can work in a lower version . ie, classes can be imported .. but it may be possible to throw an exception if the lower version does not support the class ...

0
source

All Articles