我正在尝试将相机图像从一个意图发送到另一个意图来显示。目前我正在尝试使用以下方法,
一旦图像被捕获
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode)
{
case CAMERA_RECEIPTREQUEST:
if(resultCode== Activity.RESULT_OK)
{
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 8;
//ImageView jpgView = (ImageView)findViewById(R.id.imageView1);
Bitmap receipt = BitmapFactory.decodeFile(photo.toString(),options);
Intent imagepass = new Intent(Activity1.this,Activity2.class);
imagepass.putExtra("imagepass", imagepass);
startActivity(imagepass);
在第二个活动
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.receiptreview);
//creating view ids
createViewIds();
Bitmap receiptimage = (Bitmap) getIntent().getExtras().getParcelable("imagepass");
receipt.setImageBitmap(receiptimage);
}
但它显示 StackOverFlow 错误,
at java.util.HashMap$EntrySet.iterator(HashMap.java:944)
at android.os.Parcel.writeMapInternal(Parcel.java:486)
at android.os.Bundle.writeToParcel(Bundle.java:1552)
at android.os.Parcel.writeBundle(Parcel.java:502)
at android.content.Intent.writeToParcel(Intent.java:5477)
我不确定我是否尝试了错误的方法。我正在寻找一些样本或解决方案。
谢谢你们的帮助。