How to make android app which is download specific part of web content programmatically?

107 Views Asked by At

I am working in my project where required that use specific part of web content not whole data of website. there are any way to do this in android?

1

There are 1 best solutions below

0
Heena Khan On

I prefer to download whole data of web after that use required part of content. First download the data like that.

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
        }
    }
}

After that you can use line for collecting required data.