Sumber : Android Beyond Java

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" 
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"> 

 <ImageView android:id="@+id/image_view" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" 
            android:layout_gravity="center" />

</LinearLayout>

Imageweb.java

package com.wilis.Imageweb;

import java.net.HttpURLConnection;
import java.net.URL;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.Toast;

public class Imageweb extends Activity {
    private ImageView imageView;
    private Bitmap loadedImage;
    private long loadInterval = 1000L * 60L * 60L;
    private long lastLoadTime = 0;
    private String imageHttpAddress = "https://nsafaat.files.wordpress.com/2011/07/entry-master1.png";
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        imageView = (ImageView) findViewById(R.id.image_view);       
        downloadFile(imageHttpAddress);
    }
   
    void downloadFile(String imageHttpAddress) {
        if (System.currentTimeMillis() - lastLoadTime > loadInterval) {
            lastLoadTime = System.currentTimeMillis();
            URL imageUrl = null;
            try {
                imageUrl = new URL(imageHttpAddress);
                HttpURLConnection conn = (HttpURLConnection) imageUrl.openConnection();
                conn.connect();
                loadedImage = BitmapFactory.decodeStream(conn.getInputStream());
                imageView.setImageBitmap(loadedImage);
            } 
            
            catch (Exception e) {
                Toast.makeText(getApplicationContext(), "Unable to load image: "+ e.getMessage(), Toast.LENGTH_LONG).show();
                e.printStackTrace();
            }
        }
    }
} 

inti program itu hanya utk menampilkan gambar entry-master1.png yg ada di nsafaat.wordpress.com