国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

安卓程序raw文件放在s d卡代碼實例

2019-11-02 14:50:02
字體:
來源:轉載
供稿:網友

   void copyAssets()

  {

  String[] files;

  try

  {

  files = this.getResources().getAssets().list("");

  }

  catch (IOException e1)

  {

  return;

  }

  if(!mWorkingPath.exists())

  {

  if(!mWorkingPath.mkdirs())

  {

  new AlertDialog.Builder(this)

  .setTitle(R.string.ERROR)

  .setMessage(R.string.FAILED_DIR_CREATE)

  .setPositiveButton(android.R.string.ok, new OnClickListener(){

  @Override

  public void onClick(DialogInterface dialog, int which)

  {

  dialog.dismiss();

  }

  })

  .create()

  .show();

  }

  }

  for(int i = 0; i < files.length; i++)

  {

  try

  {

  String fileName = files[i];

  if(fileName.compareTo("images") == 0 ||

  fileName.compareTo("sounds") == 0 ||

  fileName.compareTo("webkit") == 0)

  {

  continue;

  }

  File

看吧電影網[www.aikan.tv/special/kanbadianyingwang/]
outFile = new File(mWorkingPath, fileName);

  if(outFile.exists()) continue;

  InputStream in = getAssets().open(fileName);

  OutputStream out = new FileOutputStream(outFile);

  // Transfer bytes from in to out

  byte[] buf = new byte[1024];

  int len;

  while ((len = in.read(buf)) > 0)

  {

  out.write(buf, 0, len);

  }

  in.close();

  out.close();

  }

  catch (FileNotFoundException e)

  {

  e.printStackTrace();

  }

  catch (IOException e)

  {

  e.printStackTrace();

  }

  }

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 会东县| 兖州市| 苍山县| 凌海市| 南丰县| 上思县| 碌曲县| 广平县| 河北省| 尚义县| 伊宁县| 香河县| 房产| 饶阳县| 东台市| 新闻| 安陆市| 通许县| 白朗县| 滨州市| 长阳| 宁安市| 大余县| 酉阳| 当涂县| 资阳市| 广南县| 富平县| 钦州市| 天长市| 太湖县| 阿克苏市| 乳山市| 深水埗区| 重庆市| 泰和县| 含山县| 绩溪县| 罗田县| 含山县| 岫岩|