title: Parse large csv files java on Android
body: <p>I have a csv file, you need to migrate the database. 
  I created a class for its parse and transfer to the database, but is quite slow. 
  Import takes about three minutes. Is there any way to make it faster? 
  I apologize for my English.
  Thanks in advance!</p>
  
  <pre><code>final String[] SCANCODES = {"CODEPRODUCT", "SCANCODE"};
  dbSync.importCSV(SCANCODES, "SCANCODES.CSV", "SCANCODES");  
  
  ////
  .....
  ////
  
  public void importCSV(String[] tableCol, String nameFile, String nameTable) {
          final File DATABASE_DIRECTORY = new File(
          Environment.getExternalStorageDirectory(), "ImportExport");
          final File PATH = new File(DATABASE_DIRECTORY,"SCANCODES.CSV");
          ContentValues cv = new ContentValues();
          BufferedReader br = null;
          String s = "";
          boolean skipLines = true;
          String[] data;
          db.beginTransaction();
          try {
              br = new BufferedReader(new InputStreamReader(new FileInputStream(PATH), "Windows-1251"));
              while ((s = br.readLine()) != null) {
                  //skip header
                     if (skipLines) {
                          skipLines = false;
                          continue;
                      }
                  //- 1 not skip blank
                  data = s.split(";", -1);
                  for (int i = 0; i &lt; data.length - 1; ++i) {
                      cv.put(tableCol[i], data[i]);
                  }
                  db.insert(nameTable, null, cv);
              }
              db.setTransactionSuccessful();
          } catch (IOException e) {
              e.printStackTrace();
          } finally {
              try {
                  db.endTransaction();
                  br.close();
                  new Folder().deleteFolder();
  
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
      }
  </code></pre>
  
  <p>EDIT
  Added encoding</p>