AssetManager am = context.getAssets();AssetFileDescriptor afd = null;try {    afd = am.openFd( "MyFile.dat");    // Create new file to copy into.    File file = new File(Environment.getExternalStorageDirectory() + java.io.File.separator + "NewFile.dat");    file.createNewFile();    copyFdToFile(afd.getFileDescriptor(), file);} catch (IOException e) {    e.printStackTrace();}
public static void copyFdToFile(FileDescriptor src, File dst) throws IOException {    FileChannel inChannel = new FileInputStream(src).getChannel();    FileChannel outChannel = new FileOutputStream(dst).getChannel();    try {        inChannel.transferTo(0, inChannel.size(), outChannel);    } finally {        if (inChannel != null)            inChannel.close();        if (outChannel != null)            outChannel.close();    }}

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. android最佳实践(四)
  2. Android探索之旅 | Android简介
  3. Android负责人:完全开放和一致体验是挑战
  4. Android(安卓)三类框架的理解以及MVVM框
  5. android那些事——android的成长
  6. Android系统架构-----Android的系统体系
  7. 【android基础】之在程序中设置android:g
  8. Android软件工程师之不归路
  9. android最佳实践(二)
  10. Android(安卓)4高级编程(第3版) 试读