java - Android SQLite getContact issue -
hey guys i've done tutorial: http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/
and found useful doesn't go on how use 'db.getcontact()'.
here code in handler calling it:
// getting single contact contact getcontact(int id) {     sqlitedatabase db = this.getreadabledatabase();      cursor cursor = db.query(table_contacts, new string[] { key_id,             key_name }, key_id + "=?",             new string[] { string.valueof(id) }, null, null, null, null);     if (cursor != null)         cursor.movetofirst();      contact contact = new contact(integer.parseint(cursor.getstring(0)),             cursor.getstring(1));     // return contact     return contact; }   and i'm attemping call by:
callbutton.setonclicklistener(new view.onclicklistener() {                   @override         public void onclick(view v) {             edittext edittext = (edittext)findviewbyid(r.id.edittext2);             int id = integer.parseint(edittext.gettext().tostring());              string name = db.getcontact(id);             //do              }         }                });   what right syntax calling , returning need, i've tried lot of different ways don't understand it. thanks
contact cn = db.getcontact(id);      
Comments
Post a Comment