Tuesday, June 8, 2010

Re: [android-developers] Developing Android REST client applications

Andrew Brampton wrote:
> On the slides[2] page 45 We have an Activity calling a
> ContentProvider. Now the ContentProvider checks its local database, if
> the content is not there it sends an Intent to a service which fetches
> the content, inserts it into the ContentProvider, then the
> ContentProvider calls back to the Activity (with a ContentObserver)
> and the Activity can carry on. The question I have is how is this
> callback setup. The ContentProvider exposes simple methods, query,
> insert, update, delete which don't seem easy to adapt to a callback
> interface.

The ContentObserver *is* your callback. You call
registerContentObserver() to say that you want to find out about certain
changes to the content, supplying a ContentObserver. That observer will
be called with onChange() when such a change occurs.

---------

I haven't watched the presentation yet but I did read through the
slides. Off the cuff, the architecture presented there will probably
work well for something that is pretty truly RESTful, where the REST API
specifically is designed for inserting, updating, and deleting data. So,
for example, I can easily see the Twitter API fitting their proposed
architecture, at least for the timeline, but perhaps only for read
operations.

I'll have to experiment with their structure sometime and see if I can
create some reusable bits to reduce the complexity. Based on the slides,
this doesn't feel terribly easy for a developer to implement.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!

--
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

No comments:

Post a Comment