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作为位图变量...任何人都可以帮助我?