Content Provider to fetch results from web server?

6.5k views Asked by At

I want to create a content provider that will bring results from a web server. Its like I send some post parameters to my web server and it returns me with some JSON response which I must parse and show it in the Quick Search Box of android.

I already looked into SearchableDictionary but they don't seem to be connecting to a server to get results. I searched over the web but no proper examples anywhere.

How can I do it?

1

There are 1 answers

6
Vikram Bodicherla On BEST ANSWER

ContentProviders are not meant to be asyncronous sources of data. In such a situation, you'll need to create a SyncAdapter which keeps a local database in sync with a remote datastore and expose data from this local database. ContentResolvers integrate well with SyncAdapters to provide for this.

Read point 4 from 'Before you start building' on http://developer.android.com/guide/topics/providers/content-provider-creating.html#DataStorage