문제

I'd like set up something like RingtonePreference but for vibration patterns, ListPreference seems like a good place to start but does not allow inclusion of an onClick handler. How would I go about extending it to add one? Is that even possible? And where can I find the source code for ListPreference, maybe I could just copy it it and make the edits I need?

도움이 되었습니까?

해결책

Its pretty easy actually. you can find the source of ListPreference at: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/1.5_r4/android/preference/ListPreference.java

as you can see in the source, you just need to overwrite onPrepareDialogBuilder and mess with the onClick section. Note that you'll have to do some editing since you can't use private instance variables, but there are getters and setters for each one so its pretty straightforward

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top