Getting integer or index values from a list preference

后端 未结 4 1343
庸人自扰
庸人自扰 2020-12-17 08:30

I\'m creating lists in a shared preference and when the onPreferenceChanged() method is called I want to extract the index of the item in the list or an integer value in som

4条回答
  •  囚心锁ツ
    2020-12-17 09:26

    Based on the Android's ListPreference, I created IntListPreference. The usage is straighforward - simply put this snippet in your preferences xml:

        
    

    and that in strings.xml

    Number of logs per cache
    
        10
        20
        50
        Give me all!
    
    
        10
        20
        50
        -1
    
    

提交回复
热议问题