Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/179.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 从网页中复制一个应用程序文件_Android - Fatal编程技术网

Android 从网页中复制一个应用程序文件

Android 从网页中复制一个应用程序文件,android,Android,我已经做了一个应用程序,必须从一个网页复制一个文件,以下代码不做的工作,它无法找到该文件 File ekstern = new File("http://192.168.13.40/cache.manifest"); copyFile(ekstern, intern); 以及copyFile方法: public static void copyFile(File in, File out) throws IOException { FileChannel inChan

我已经做了一个应用程序,必须从一个网页复制一个文件,以下代码不做的工作,它无法找到该文件

File ekstern = new File("http://192.168.13.40/cache.manifest");

copyFile(ekstern, intern);
以及copyFile方法:

    public static void copyFile(File in, File out) throws IOException {
        FileChannel inChannel = new
            FileInputStream(in).getChannel();
        FileChannel outChannel = new
            FileOutputStream(out).getChannel();
        try {
            inChannel.transferTo(0, inChannel.size(),
                        outChannel);
        } 
        catch (IOException e) {
            throw e;
        }
        finally {
            if (inChannel != null) inChannel.close();
            if (outChannel != null) outChannel.close();
        }
   }
但是代码说这个文件不存在


使用ekster.exists()进行测试。

您不能使用文件对象从网页获取内容。您必须使用HttpClient