[英]Set PreferenceScreen type as “Select Contact”
I have a PreferenceActivity with a few EditText and CheckBox Preferences. 我有一个PreferenceActivity和一些EditText和CheckBox首选项。 I would like to add a preference of Contact so that when the button was pressed it would allow the selction of a Contact's number 我想添加一个Contact的首选项,这样当按下按钮时,它将允许选择一个联系人的号码
Is that possible using the PreferenceActivity functionality? 可以使用PreferenceActivity功能吗?
TIA TIA
Pat Long 帕特龙
AFAIK I know there is no direct Preference
object to do this. AFAIK我知道没有直接的Preference
对象来做这件事。 But you can create your own, if you extend DialogPreference
or Preference
但是,如果扩展DialogPreference
或Preference
,则可以创建自己的
Probably you have to just fire a contact picker, and listen for the results. 可能你只需要点击一个联系人选择器,然后听取结果。
I would be too interested, so I would love to see the code shared. 我太感兴趣了,所以我很乐意看到代码共享。
Check out what this person did: http://yenliangl.blogspot.com/2010/01/provide-phonepreference-from.html . 看看这个人做了什么:http: //yenliangl.blogspot.com/2010/01/provide-phonepreference-from.html 。 It seems a bit hacky, but by subclassing RingtonePreference you can override the RingtonePreference bits and get the benefit of the package-protected internals that RingtonePreference has access to. 这看起来有点hacky,但是通过继承RingtonePreference你可以覆盖RingtonePreference位并获得RingtonePreference可以访问的受包保护的内部的好处。
Combined with the info on the Contacts API (http://developer.android.com/resources/articles/contacts.html), things seem to work. 结合Contacts API(http://developer.android.com/resources/articles/contacts.html)上的信息,事情似乎有效。 Maybe someone else will pipe up with a better way. 也许其他人会用更好的方式来管道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.