how i can read from text file and insert this data to database in android -


i need read text file , insert data database

the text file contain lines , each line contain data separated comma

i code running without error

and lines reads successfully

but data not save database

public void getfrom_text(){ string []message=null;

        bufferedreader br=null;         string name1, faculty1, deparment1, officenumber1, email1, phone1,officehour1;         long e;         try{             string scurrentline = null;              br =new bufferedreader(new inputstreamreader(getassets().open("ab.txt")));              scurrentline = br.readline();              while((scurrentline = br.readline()) != null){                  log.d("line file", scurrentline);             if(scurrentline!=null ){               message=scurrentline.split(",");               faculty1=message[0];                 deparment1=message[1];                 name1=message[2];                 officenumber1=message[3];                 phone1=message[4];                 email1=message[5];                 officehour1=message[6];                 db.open();                 db.insertrecord(faculty1,deparment1,name1,officenumber1,phone1,email1,officehour1);                 db.close();           }}}         catch (ioexception e1){             e1.printstacktrace();         }finally{             try {                 if (br !=null)br.close();              }catch (ioexception ex){                 ex.printstacktrace();             }         }      } insertrecord method work . 


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -