Android examples for App:Assets File
copy File inside Asset Folder
/*/* w w w . ja va 2 s . c o m*/ * Copyright 2013 The Kava Project Developers. See the COPYRIGHT file at the top-level directory of this distribution * and at http://kavaproject.org/COPYRIGHT. * * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the * MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. This file may not be copied, * modified, or distributed except according to those terms. */ //package com.java2s; import android.content.res.AssetManager; import java.io.*; public class Main { private static boolean copyFile(File assetFile, File storageFile, AssetManager assetManager) { try { InputStream in = assetManager.open(assetFile.getPath()); FileOutputStream out = new FileOutputStream(storageFile); byte[] buffer = new byte[1024]; int read; while ((read = in.read(buffer)) != -1) { out.write(buffer, 0, read); } in.close(); out.close(); return true; } catch (FileNotFoundException e) { return false; } catch (IOException e) { return false; } } }