1. ImageView 繪製圖片 ...
1. ImageView 繪製圖片
package com.ddx.testimageview; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Environment; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.widget.ImageView; import java.io.File; public class ShowImageView extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_show_image_view); //Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory().getPath() + File.separator + "11.jpg"); Bitmap bitmap = BitmapFactory.decodeFile(Environment.getDataDirectory().getPath() + File.separator + "11.jpg"); Log.d("DDX", "externalStorageDirectory = " + Environment.getExternalStorageDirectory().getPath() + File.separator + "11.jpg"); ImageView imageView = (ImageView) findViewById(R.id.imageView); imageView.setImageBitmap(bitmap); } }