Getting list of subfolders name and files name in android source package

独自空忆成欢 提交于 2019-11-29 12:18:04

I suggest you put the .sql file in assets folder. By doing that, you are free to manipulate your file with File IO API.

Sorry all, i just now put it in bounty but i'm able to resolve it by myself by the short time after i put it in bounty. Anyway, my solution is to open the apk file that inside the android device (data/app/....apk) as a zip stream. Then list all the file that start with com/ods/scm/script/update. Here my method to get all file that start with it :

public ArrayList openApk(String filePath){
  ArrayList<String> list = new ArrayList<String>();
  FileInputStream fis = null;
  ZipInputStream zipIs = null;
  ZipEntry zEntry = null;
  try {
      fis = new FileInputStream(filePath);
      zipIs = new ZipInputStream(new BufferedInputStream(fis));
      while((zEntry = zipIs.getNextEntry()) != null){
        if(zEntry.getName().startsWith("com/ods/scm/script/update/"))
          list.add(zEntry.getName());
      }
      zipIs.close();
  } catch (FileNotFoundException e) {
      e.printStackTrace();
  } catch (IOException e) {
      e.printStackTrace();
  }
  return list;
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!