package com.szguide;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;
public class Hello extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try{
URL url = new URL("http://image.hnol.net/c/2009-03/17/18/20090317180036211-2121820.jpg");
URLConnection conn = url.openConnection();
conn.connect();
InputStream in = conn.getInputStream();
BufferedInputStream bis= new BufferedInputStream(in);
ImageView imageview = new ImageView(this);
Bitmap bitmap = BitmapFactory.decodeStream(bis);
imageview.setImageBitmap(bitmap);
setContentView(imageview);
}catch(Exception e){
}
}
}
|
|