Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.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
Java 如何制作android应用程序,以编程方式下载web内容的特定部分?_Java_Android_Android Studio_Download_Web Content - Fatal编程技术网

Java 如何制作android应用程序,以编程方式下载web内容的特定部分?

Java 如何制作android应用程序,以编程方式下载web内容的特定部分?,java,android,android-studio,download,web-content,Java,Android,Android Studio,Download,Web Content,我在我的项目中工作,需要使用网站内容的特定部分,而不是网站的全部数据。 在安卓系统中有什么方法可以做到这一点?我更喜欢在使用所需部分内容之后下载整个web数据。 首先下载这样的数据 public static void main(String[] args) { URL url; InputStream is = null; BufferedReader br; String line; try { url = new URL("

我在我的项目中工作,需要使用网站内容的特定部分,而不是网站的全部数据。
在安卓系统中有什么方法可以做到这一点?

我更喜欢在使用所需部分内容之后下载整个web数据。 首先下载这样的数据

public static void main(String[] args) {
    URL url;
    InputStream is = null;
    BufferedReader br;
    String line;

    try {
        url = new URL("your.website/");
        is = url.openStream();  // throws an IOException
        br = new BufferedReader(new InputStreamReader(is));

        while ((line = br.readLine()) != null) {
            System.out.println(line);
        }
    } catch (MalformedURLException mue) {
         mue.printStackTrace();
    } catch (IOException ioe) {
         ioe.printStackTrace();
    } finally {
        try {
            if (is != null) is.close();
        } catch (IOException ioe) {
            // nothing to see here
        }
    }
}

之后,您可以使用来收集所需数据。

我更喜欢在使用所需部分内容之后下载整个web数据。 首先下载这样的数据

public static void main(String[] args) {
    URL url;
    InputStream is = null;
    BufferedReader br;
    String line;

    try {
        url = new URL("your.website/");
        is = url.openStream();  // throws an IOException
        br = new BufferedReader(new InputStreamReader(is));

        while ((line = br.readLine()) != null) {
            System.out.println(line);
        }
    } catch (MalformedURLException mue) {
         mue.printStackTrace();
    } catch (IOException ioe) {
         ioe.printStackTrace();
    } finally {
        try {
            if (is != null) is.close();
        } catch (IOException ioe) {
            // nothing to see here
        }
    }
}

之后,您可以使用收集所需数据。

简单HTTP请求如何?简单HTTP请求如何?