java - Why i am getting 2/4 rows when i nsert 1/2 row(s) in mySql -


i trying save file coordinates(lat, long) online database . made method below. read file string external storage , split end latitude arraylist , longitude arraylist. afterwards make insert statment db. works fine, exampe if have 1 coordinate(x, y) in file double in db (1 row(x, y) , 2 row(x, y)), , if have 2 points 4 rows in db! - tried many hours find out did wrong. stuck in this! - appreciated,

private void filetodatabase() {         file path = environment.getexternalstoragepublicdirectory(environment.directory_documents);          if (myfile().isempty()) {             boolean delete = (new file(path, filename)).delete();             if(delete) {                 return;             }         } else {             string[] latlngreplaced = myfile().replace("\n", ",").split(",");              list<string> lats = new arraylist<>();              list<string> lngs = new arraylist<>();               (int = 0; < latlngreplaced .length; i++) {                   if (i % 2 == 0) {                     lats.add(latlngerstatt[i]);                  } else {                     lngs.add(latlngerstatt[i]);                  }             }             (int = 0, j = 0; < lats.size() && j < lngs.size(); i++, j++) {                  coordinate c = new coordinate (lats.get(i), lngs.get(j));                  string in = "insert coordinate(latitude, longitude) values (" + c.getlatitude() + "," + c.getlongitude() + ")";                  list<namevaluepair> namevaluepairs = new arraylist<>(1);                 namevaluepairs.add(new basicnamevaluepair("test", in));                 new asynctasksendfila(this).execute(new pair<>(namevaluepairs, httpclient));             }         }  


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -