0
我从我的设备库中选择了一张图片的代码,代码就像这样我使用。从图库中选择一张图片,图片图片之后我想在不同的页面上显示
Intent getintent = new Intent(Intent.ACTION_GET_CONTENT);
getintent.setType("image/*");
Intent pickintent = new Intent(Intent.ACTION_PICK,
MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
pickintent.setType("image/*");
Intent chooserintent = Intent.createChooser(getintent, "Select Image");
chooserintent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] {pickintent});
startActivityForResult(chooserintent, SELECT_PICTURE);
chooserintent.putExtra("data", SELECT_PICTURE);
我可以把图片作为额外的发送给另一个意图吗?这是我第2页的代码,以证明我在第一次活动选择画面
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_showpic2);
findViewById(R.id.imageButton); // Replace with id of your button.
Intent intent = getIntent();
Bitmap gambar = intent.getData("data");
ImageView imageView = (ImageView) findViewById(R.id.imageView);
imageView.setImageBitmap(gambar);
}
我得到的错误与此代码,可以有人帮助我吗?多谢你们 !! 抱歉我的英文不好。
请从一个活动发送图像的URI与另一个,而不是整个位图,如果问题仍然存在提供代码发送图像 –
您在清单中添加了一个代码,该代码在某些设备上打开galary或图像后,重定向到关闭页面或返回页面,我想你会到达android:configChanges =“orientation | screenSize” – Amitsharma
这是您在清单中写入此行时生成的问题现在您需要收集最新的代码以获取galary或相机代码读取pic方法的新方法Android开发人员博客 – Amitsharma