sqlite - SQLiteDatabase Android + parse.com -


i want take data parse.com

public void parsequerymap() {          query = new parsequery("myobject");           query.findinbackground(new findcallback() {               public void done(list<parseobject> myobject, parseexception e) {               if (e == null) {                   ( int = 0; < myobject.size(); i++) {                                             stranaget = myobject.get(i).getstring("country");                               oblastget = myobject.get(i).getstring("district");                               gorodget = myobject.get(i).getstring("city");                      }               }  } 

and want make of data database android

dbhelper dbhelper;  @override      public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);             setcontentview(r.layout.main);              dbhelper = new dbhelper(this);             contentvalues cv = new contentvalues();             sqlitedatabase db = dbhelper.getwritabledatabase();             string name = etname.gettext().tostring();             string email = etemail.gettext().tostring();              cv.put("name", name);             cv.put("email", email);             cursor c = db.query("mytable", null, null, null, null, null, null);              if (c.movetofirst()) {           int idcolindex = c.getcolumnindex("id");         int namecolindex = c.getcolumnindex("name");         int emailcolindex = c.getcolumnindex("email");          {           log.d(log_tag, "id = " + c.getint(idcolindex) +                                   ", name = " + c.getstring(namecolindex) +                                   ", email = " + c.getstring(emailcolindex));           } while (c.movetonext());         } else {          log.d(log_tag, "0 rows");         c.close();         }         dbhelper.close();  }      class dbhelper extends sqliteopenhelper {          public dbhelper(context context) {           super(context, "mydb", null, 1);         }          @override         public void oncreate(sqlitedatabase db) {            db.execsql("create table mytable ("               + "id integer primary key autoincrement,"                + "name text,"               + "email text" + ");");         }          @override         public void onupgrade(sqlitedatabase db, int oldversion, int newversion) {          }       } 

in example, data taken edittext, want fill database parse.com. how can be? update: tried this

public void parsequerymap() {              query = new parsequery("myobject");               query.findinbackground(new findcallback() {                   public void done(list<parseobject> myobject, parseexception e) {                   if (e == null) {                       ( int = 0; < myobject.size(); i++) {                                                 stranaget = myobject.get(i).getstring("country");                                   oblastget = myobject.get(i).getstring("district");                                   gorodget = myobject.get(i).getstring("city");                                   cv.put("name",  stranaget);                                   cv.put("email", oblastget);                                   db.insert("mytable", null, cv);                          }                   }      } 

but nothing happens

the query method used read data.

to insert data, use insert method; this:

db.insert("mytable", null, cv); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -