• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Download web page from android

so I am looking for the equivelent of you know
wget or fetch

I tried this code, except all it does is display , Hello World, Hello Android

Anyone got any idea how to download a web page?
Code:
package com.dslice;

import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

import org.apache.http.util.ByteArrayBuffer;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.widget.Toast;

public class HelloAndroid extends Activity { 
    private String html = ""; 
    private Handler mHandler; 

    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.main);
        mHandler = new Handler(); 
        checkUpdate.start(); 
    } 

    private Thread checkUpdate = new Thread() { 
        public void run() { 
            try { 
                URL updateURL = new URL("http://iconic.4feets.com/update"); 
                URLConnection conn = updateURL.openConnection(); 
                InputStream is = conn.getInputStream(); 
                BufferedInputStream bis = new BufferedInputStream(is); 
                ByteArrayBuffer baf = new ByteArrayBuffer(50); 
                
                int current = 0; 
                while((current = bis.read()) != -1){ 
                    baf.append((byte)current); 
                } 

                /* Convert the Bytes read to a String. */ 
                html = new String(baf.toByteArray()); 
                mHandler.post(showUpdate); 
                
            } catch (Exception e) { 
            } 
        } 
    }; 

    private Runnable showUpdate = new Runnable(){ 
        public void run(){ 
            Toast.makeText(HelloAndroid.this, "HTML Code: " + html, Toast.LENGTH_SHORT).show(); 
        } 
    }; 
}
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones