Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content Provider to fetch results from web server?

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?

like image 386
Sudarshan Bhat Avatar asked Nov 14 '22 11:11

Sudarshan Bhat


1 Answers

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

like image 192
Vikram Bodicherla Avatar answered Nov 16 '22 04:11

Vikram Bodicherla