开发者

Need advice in how to update my Activity due to contact info changes

I have an activity which queries and display some Contact Information. It has a button which launches the intent for 'Edit Contact' (the default Android activity).

What should I do to refresh my view in case user edits Contact Information?


I would suggest a content observer. If you requery in onResume then you'll be requerying when they leave and return for other reasons as well. Which is more wasteful than using the content observer.


I've seen that the contacts ContentObserver doesn't always fire in every case. For example, I seem to recall that editing an existing phone number didn't necessarily trigger an update.

Querying every time should be relatively quick anyway if you want to do that, but if the EDIT action returns a result (i.e. when called via startActivityForResult), you could use that as a trigger to requery the contact information only as appropriate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜