Tuesday, January 25, 2011

[android-developers] How do you avoid self notification when with ContentProviders

I've implemented a custom ContentProviders that calls notifyChange
passing in null as the ContentObserver. There doesn't seem to be a way
to pass a ContentObserver to a ContentProvider so that's the only option.

I would now like to avoid receiving self notifications for changes I
make via my UI in order to avoid having to requery the database. In
other words, I've implemented a scenario where I add some data via the
UI which is then inserted into the ContentProvider. The UI is already
aware of the new data so I don't want to get a change notification.
Since the ContentProvider can't get a hold of my ContentObserver, the
ContentObserver#deliverSelfNotifications mechanism doesn't work.
I tried setting a thread local boolean in my code, but the change
notifications are delivered asynchronously via a binder thread so that
doesn't work either.

Does anyone know of a way to avoid self (or detect) self notifications
when using ContentProviders?

Regards,

Pepijn

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate