android - how to fetch all column Values based on Email -


i want fetch column table tblreg, has column registration,name,password,email , contact out email checked while registration ,it unique column.. value exist once in table of 1 email.

i having login matching email password , passing value of email through intent in home activity keyname want fetch detail sqllite based on email,i receiving getextra through intent.

here code of home activity

public class activity_home extends activity {     databasehandler dbh = new databasehandler(this); string regid,emailid,name,contact,data;      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_activity_home);         textview lblemail = (textview) findviewbyid(r.id.textview1);         textview lblreg = (textview) findviewbyid(r.id.textview1);         textview lblname = (textview) findviewbyid(r.id.textview1);         dbh.open();         try {             data = getintent().getextras().getstring("keyname");              cursor m1 = dbh.getalldata(data);             if (m1 != null) {                 m1.movetofirst();                 name = m1.getstring(m1.getcolumnindex("name"));                 regid = m1.getstring(m1.getcolumnindex("registration"));                 contact = m1.getstring(m1.getcolumnindex("contact"));                 emailid = m1.getstring(m1.getcolumnindex("email"));                 m1.close();             }              if (!data.equals("")) {                  lblemail.settext(html.fromhtml("email: <b>" + emailid + "</b>"));                 lblreg.settext(html.fromhtml("email: <b>" + regid + "</b>"));                 lblname.settext(html.fromhtml("email: <b>" + name + "</b>"));             } else {                 toast.maketext(getapplicationcontext(), "data null aya hai bhai", toast.length_short).show();             }         }         catch (exception e)         {             string ex=e.tostring();             toast.maketext(getapplicationcontext(), ex, toast.length_short).show();         }             } 

i have used database handler class using query ,i think there problem in query please have in ,i sharing cursor code please correct me wrong. quick response appreciated , in advance.i beginner in android please help.

 public cursor getalldata(string parentkey) {      string[] fields = new string[] {             key_regid,             key_name,             key_password,             key_email,             key_mobileno + " _id "     };      cursor cursor = mdb.query(tblreg,             fields,             key_email + " = ?",             new string[] {                     "" + parentkey             },             null,             null,             key_name);      cursor.movetofirst();     return cursor; } 

please collapse in coding , highly appreciated.

hey guyz have solved problem of fetching data tables based on column values , know want share sloppy mistakes.

textview lblemail = (textview) findviewbyid(r.id.textview1);             textview lblreg = (textview) findviewbyid(r.id.textview1);             textview lblname = (textview) findviewbyid(r.id.textview1); 

this code has written stated below

textview lblemail = (textview) findviewbyid(r.id.textview1);                 textview lblreg = (textview) findviewbyid(r.id.textview2);                 textview lblname = (textview) findviewbyid(r.id.textview3); 

rest working great,any viewer want learn how fetch column values based upon value passed user can refer above code.


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -