I have an a bitmap image in my Activity like this:
Bitmap image4 = BitmapFactory.decodeResource(getResources(), R.drawable.hello);
image1.setImageBitmap(image4);
I'm trying to pass this image in fragment using this code:
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.addToBackStack(null);
Secondfrag yourFragment = new Secondfrag();
Bundle b = new Bundle();
b.putParcelable("BitmapImage",image4);
yourFragment.setArguments(b);
fragmentTransaction.add(R.id.frag, yourFragment, "FRAGMENT");
fragmentTransaction.commit();
and trying to get this image in fragment like this:
Bundle b=this.getArguments();
String page=b.getString("BitmapImage");
image2.setImageURI(Uri.parse(page));
But there is no image display in my Fragment.How to resolve this issue?