3
通過點擊一個按鈕,我是從畫廊拾取圖像和設定它到ImageView的......這裏是代碼..獲取位圖圖像,並把它轉換成位圖變量
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data)
{
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
ImageView imageView = (ImageView) findViewById(R.id.iImage);
imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath));
}
}
現在我想要在位圖變量中獲得這個圖像,並需要將它添加到ArrayList作爲位圖變量...任何人都可以幫助我?