2014-07-25 181 views
-5
Bitmap r = imagelist[args.Position].Data; 
      byte[] arr = getByteFromBitmap(r); 
      var activity2 = new Intent(this, typeof(FullScreenImageViewActivity)); 
      activity2.PutExtra("FullImage", arr); 
      StartActivity(activity2); 

我得到correkt字节[]并把它放在意图。但它永远不会把我带到其他活动,所以下面的代码不会被触发。传递值从一个活动到另一个失败

byte[] b = Intent.GetByteArrayExtra("FullImage"); 
     Bitmap bitmap = BitmapFactory.DecodeByteArray(b, 0, b.Length); 
     imageView.SetImageBitmap(bitmap); 
+0

请检查: HTTP:// stackoverflow.com/questions/2459524/how-can-i-pass-a-bitmap-object-from-one-activity-to-another – user3872416

+0

我尝试过,但不知何故它甚至不启动其他活动 –

回答

0

首先,你不应该在intent参数中使用“typeof”。
它应该去:
var activity2 = new Intent(this,FullScreenImageViewActivity.class);
秒,你在Bitmap上使用.putExtra,但是试图在第二个活动中提取一个字节数组。这将不会结束。

0

试试这个代码.....

传递意图..

byte[] arr = YOURBYTEARRAY; 

Intent intent= new Intent(this, FullScreenImageViewActivity.class); 
intent.PutExtra("FullImage", arr); 
StartActivity(intent); 

至获取意图值..

byte[] b = getIntent().getByteArrayExtra("FullImage") 
相关问题