我尝试过两种方法:直接将位图从一个活动传递到另一个活动 - 不起作用。活动即将开始后,它返回"系统失败"。 所以我决定将位图转换为bytearray,然后将所述aray传递给另一个活动。这结果导致应用程序没有崩溃。它只是结束了自己。没有警告。好像我打电话给#34;完成()"并没有别的开放。我所做的就是:
private void OnItemClick(object sender, int position)
{
if(RecViewLay != (int)RecyclerLayout.Friends)
{
//Convert Bitmap to ByteArray
Bitmap bm = loadPhotos.pictures[position].Picture;
byte[] bitmapData;
using (var stream1 = new MemoryStream())
{
bm.Compress(Bitmap.CompressFormat.Png, 100, stream1);
bitmapData = stream1.ToArray();
}
var activity2 = new Intent(this, typeof(Activity_RecyclerView_Comments));
activity2.PutExtra("galleryType", 0); // 0 neuste, 1 beste
activity2.PutExtra("picturesinarow", 1); // gridbilder
activity2.PutExtra("recyclerLayout", (int)RecyclerLayout.Comments_Singles); // unterschiedliche layouts
activity2.PutExtra("hasHeader", true);
activity2.PutExtra("thumbnails", false);
activity2.PutExtra("RecViewLayout", (int)RecyclerViewLayouts.Userpicture_FullScreen);
activity2.PutExtra("BitmapInByteArray", bitmapData);
Activity_RecyclerView.gallery = false;
activity2.PutExtra("finalActivity", (int)RecviewHeader.Userpicture_FullScreen); // What Activity do we want to see?
//soleley for userpic fullsc
activity2.PutExtra("username", loadPhotos.pictures[position].username);
activity2.PutExtra("taskID", loadPhotos.pictures[position].taskID);
StartActivity(activity2);
}
}
有什么事情可以吗?你们有没有其他方式在活动之间传递位图?
谢谢!