tags:

views:

66

answers:

2

Hi,

I have an activity which queries and display some Contact Information. And 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?

  • requery in the onResume() of my activity?
  • add a content observer?

Thank you for any advice.

A: 

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.

JasonOfEarth
A: 

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.

Christopher