天天看點

擷取SD卡中的圖檔資源并顯示

  1. ImageView iv = (ImageView) findViewById(R.id.image_test); 
  2. Bitmap bit = BitmapFactory.decodeFile("/sdcard/dcd/images/xinwen.gif"); 
  3. iv.setImageBitmap(bit);
button.setBackgroundDrawable(new BitmapDrawable(BitmapFactory.decodeFile("圖檔路徑")));      

SD卡根目錄:

String DATABASE_PATH = android.os.Environment.getExternalStorageDirectory().getAbsolutePath();

繼續閱讀