在虚拟机上跑应用时候 文档是在raw文件夹里 视频的path是代码固定的从sdcard里push进去的。。当然结果是在安装在电脑后 文档固定 而视频因为手机里没有和他名字重复的无法打开,就不能实现文档和视频的功能 我该怎么做,还要学习哪些相关知识呢?

解决方案 »

  1.   

    java基础 文件
    看一下File类
      

  2.   

    ...
    private Vector<String> allFilePath = new Vector<String>();
    ...
    private String getFilePath(String dirpath) {
            File file = new File(dirpath);
            String path;
    String mpath;
            if (file.exists()) {
                if (file.isDirectory()) {
                    File[] tmp = file.listFiles();
                    for (File f : tmp) {
                        path = getFilePath(f.getAbsolutePath());
                        if (path != null&&path.endsWith("xx视频类型")) {
                            allFilePath.add(path);
                        }
                    }
                } else {
            mpath = file.getPath();
                    if (mpath!= null&&mpath.endsWith("xx视频类型")) {
                            allFilePath.add(mpath);
                        }
                    return mpath;
                }
            }
            return null;
        }