how i can read from text file and insert this data to database in android
<p>i need to read from text file and insert this data to database</p>

<p>the text file contain lines and each line contain data separated by comma</p>

<p>i do this code its running without error</p>

<p>and the lines reads successfully</p>

<p>but the data not save successfully to database</p>

<p>public void GetFrom_Text(){
         String []message=null;</p>

<pre><code>        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 from 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 well .
</code></pre>
