Java tutorial
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import android.content.Context; public class Main { public static void copyDB(Context context, String fileName) throws IOException { String filePath = context.getFilesDir().getAbsolutePath() + "/" + fileName; if (new File(filePath).exists()) { return; } FileOutputStream fos = new FileOutputStream(new File(filePath)); InputStream is = context.getResources().getAssets().open(fileName); byte[] buffer = new byte[1024 * 500]; int count = 0; while ((count = is.read(buffer)) > 0) { fos.write(buffer, 0, count); } fos.close(); is.close(); } }