Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.res.Resources; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; public class Main { private final static int BUFFER_SIZE = 1024 * 1024; public static void copyFileFromAssets(Context context, String fileName, File outputFile) { byte[] buffer = new byte[BUFFER_SIZE]; int bytesCount; try { InputStream imageStream = context.getAssets().open(fileName); FileOutputStream fileOutputStream = new FileOutputStream(outputFile); while ((bytesCount = imageStream.read(buffer)) >= 0) { fileOutputStream.write(buffer, 0, bytesCount); } fileOutputStream.close(); imageStream.close(); } catch (IOException | Resources.NotFoundException e) { e.printStackTrace(); } } }