getPreferenceManager deprecated

后端 未结 1 607
心在旅途
心在旅途 2021-01-13 06:49

I am making a live wallpaper for Android. I have the wall paper part working and am trying to add settings to it. In LiveWallpaperSettings I have this:

@Ov         


        
相关标签:
1条回答
  • 2021-01-13 06:54

    From the documentation for PreferenceActivity:

    Prior to HONEYCOMB this class only allowed the display of a single set of preference; this functionality should now be found in the new PreferenceFragment class. If you are using PreferenceActivity in its old mode, the documentation there applies to the deprecated APIs here.

    So you can either switch to using Fragments or you can ignore these warnings. (Understand that deprecated methods will disappear from the API someday...)


    Can someone point to a contemporary example of code for LiveWallpaper using PreferenceFragments?

    There isn't a major difference between the methods used in PreferenceActivities and PreferenceFragments, switching to Fragments in general is the big change. But PreferenceFragment has an example and you see you can still use methods like addPreferencesFromResource() in it's modern form.

    0 讨论(0)
提交回复
热议问题