2

I am developing an android app in which the app has to download a webpage..for that how the code has to write.if any one know please help.

The page I needed to download and view in webview is this

I refer this question to achieve my goal . but i ddn't get a proper answer...

Community
  • 1
  • 1
user2223317
  • 211
  • 1
  • 3
  • 13

2 Answers2

1

You can use pocket:

Click here.

The following can be helpful.
How to download a webpage for offline viewing on Nexus 7

Community
  • 1
  • 1
Shreyos Adikari
  • 12,348
  • 19
  • 73
  • 82
1

You can use this sample code for download a html source code.

 public void getHtml() throws ClientProtocolException, IOException
 {
    HttpClient httpClient = new DefaultHttpClient();
    HttpContext localContext = new BasicHttpContext();
    HttpGet httpGet = new HttpGet("http://www.androidaspect.com/");
    HttpResponse response = httpClient.execute(httpGet, localContext);
    String result = "";

    BufferedReader reader = new BufferedReader(
        new InputStreamReader(
          response.getEntity().getContent()
        )
      );

    String line = null;
    while ((line = reader.readLine()) != null){
      result += line + "\n";

    }

 }

Be suer to use it with AsyncTask and not on the main thread. And don't forget for

<uses-permission android:name="android.permission.INTERNET">

permission.

pzagor2
  • 709
  • 10
  • 24