package com.guo; import java.io.File; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageView; public class MainAct extends Activity { /** Called when the activity is first created. */ private ImageView img; //SD图片路径 private String filepath = "/sdcard/hot.png"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); img = (ImageView) findViewById(R.id.img); File file = new File(filepath); if (file.exists()) { Bitmap bm = BitmapFactory.decodeFile(filepath); //将图片显示到ImageView中 img.setImageBitmap(bm); } } }