Java tutorial
//package com.java2s; import android.content.Context; import android.os.Environment; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { public static final String DATA_DIR = Environment.getDataDirectory() + "/data/"; private static void copyFile(Context ctx, String filename) throws IOException { InputStream in = null; OutputStream out = null; in = ctx.getApplicationContext().getAssets().open(filename); StringBuilder newFileName = new StringBuilder(); newFileName.append(DATA_DIR).append(ctx.getPackageName()).append("/").append(filename); out = new FileOutputStream(newFileName.toString()); byte[] buffer = new byte[1024]; int read; while ((read = in.read(buffer)) != -1) { out.write(buffer, 0, read); } in.close(); in = null; out.flush(); out.close(); out = null; } }