每当我尝试使用其ID在新活动中设置图像时,我的应用程序都会崩溃。
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (REQUEST_IMAGE_CAPTURE == 1) {
ImageView m = (ImageView) findViewById(R.id.a);
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
Bundle extras = data.getExtras();
Bitmap imageBitmap = (Bitmap) extras.get("data");
m.setImageBitmap(imageBitmap);
p = imageBitmap;
//REQUEST_IMAGE_CAPTURE++;
}
}
}
public void saveToList(View w){
if (REQUEST_IMAGE_CAPTURE == 1) {
ImageView m = (ImageView) findViewById(R.id.listA);
m.setImageBitmap(p);
}
Intent intent = new Intent(GroceryList.this, shopList.class);
startActivity(intent);
}
listA是链接到shopList类的活动中的id。
有没有办法可以在链接类之外的活动中设置图像?