Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Should I keep using PreferenceActivity? [duplicate]

My app supports from 2.2 to the lates Android version. The thing is that for Settings page, I am using PreferenceActivity now. However, as you know, many of its methods are deprecated and they tell me to use Fragment based settings. However, I found that if I switch to use PreferenceFragment and Fragment Activity, I cannot support 2.2 and 2.3 anymore because PreferenceFragment is supported above API level 11. Even if I use support library, it doesn't contain PreferenceFragment! I don't know why Google didn't add PreferenceFragment in the support library.

Anyways, I think I can still use the old PreferenceActivity but if it says it is deprecated, why doesn't it support an alternative in its support library?

Any advice is appreciated!

like image 756
user2062024 Avatar asked Jul 16 '13 21:07

user2062024


1 Answers

Just because it is deprecated does not mean it stops working - newer devices still support PreferenceActivity without issue. However, on larger devices (such as 10" tablets), the dual pane support of PreferenceFragment/PreferenceHeaders looks much better. Until Google adds them to the Support Library, you can use third party libraries such as UnifiedPreferences to use a single API for all versions of Android.

like image 170
ianhanniballake Avatar answered Oct 25 '22 04:10

ianhanniballake