Androidでassetsのファイルをローカルストレージにコピー
- assets/row.txt を /data/data/com.example/files/row.txt として保存する
try { InputStream inputStream = getAssets().open("row.txt"); FileOutputStream fileOutputStream = openFileOutput("row.txt", MODE_PRIVATE); byte[] buffer = new byte[1024]; int length = 0; while ((length = inputStream.read(buffer)) >= 0) { fileOutputStream.write(buffer, 0, length); } fileOutputStream.close(); inputStream.close(); } catch (IOException e) { e.printStackTrace(); }