android - Get values from database to ListView -



android - Get values from database to ListView -

i have written fetchdata() method fill listview values database.

public void fetchdata() { database = helper.getreadabledatabase(); cursor c = database.query(db.table, null, null, null, null, null, null); string[] fromdb={db.fullname,db.year}; int[] toview={r.id.tvname_lv,r.id.tv_birthday_lv}; adapter = new simplecursoradapter(this, r.layout.listview_all, c, fromdb, toview); lv.setadapter(adapter); }

it works fine. when seek utilize way, gives error.

public void fetchdata() { database = helper.getreadabledatabase(); cursor c = database.query(db.table, null, null, null, null, null, null); string birthday=db.year+" "+db.month+" "+db.day; string[] fromdb={db.fullname,birthday}; int[] toview={r.id.tvname_lv,r.id.tv_birthday_lv}; adapter = new simplecursoradapter(this, r.layout.listview_all, c, fromdb, toview); lv.setadapter(adapter); }

i want [db.year+" "+db.month+" "+db.day] view [r.id.tv_birthday_lv] in advance.

update:error "unfortunately, app has stopped". fatal exception on logcat

android listview simplecursoradapter

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -