java - App Engine datastore to Android listview -


i have set basic entity class in app engine backend.

`@entity` `public class club {`    `@id`   `private int id;`   `private string clubname;`    `public club() {`   `}`    `public int getid() {`   `return id;`   `}`    `public void setid(int id){       this.id =id;    }`     `public string getclubname() {     return clubname;   }`    `public void setclubname(string clubname) {   this.clubname = clubname;   } }` 

i have generated cloud endpoint class , generated cloud endpoint library. want able populate clubname datastore listview in android not sure how this. i'm trying follow https://developers.google.com/appengine/docs/java/endpoints/consume_android far unable understand do. i'm new , greatful if lead me in right direction please.

you can use below steps achieve objective:

1, mentioned in google doc on consuming cloud endpoints in android, ready app adding required libraries , make api calls , on getting data backend, can store data sql database. can step in onpostexecute method of asynch task

protected void onpostexecute(scorecollection scores) { // result. maybe store data sqlite database } } 

to know how store data in sqlite database please refer http://developer.android.com/reference/android/database/sqlite/sqlitedatabase.html http://www.vogella.com/articles/androidsqlite/article.html

2, query data sqlite db cursor , use simplecursoradapter display data cursor on listview in layout or activity screen

an approximate piece of code have steps below:

yourcursor = yourdatabase.query; //this cursor returned querying db adapter = new simplecursoradapter(this.getactivity(), r.layout.onerowinalistview,  yourcursor, from, to,0); // connects columns of db mentioned in array elements in row of list mentioned in array listview yourlistview = (listview) view.findviewbyid(r.id.yourlistview);//this listview element in screen layout yourlistview.setadapter(adapter); // setting adapter listview 

hope helps


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -