0

I have little problem with my Android app. First i take a photo by a camera and save it as Bitmap. Next thing i want to do is display this image in new fragment as ImageView. I don't know how to send this photo from activity to fragment. Could you help how to do that?

Nogaz
  • 29
  • 1
  • 1
  • 6
  • [Here is an answer](http://stackoverflow.com/a/23919345/1590950) I made to a related question that also answers this. – indivisible Jul 14 '14 at 14:38

2 Answers2

0

You are taking the photo in the activity, so the fastest way to figure out this problem is saving your image in cache and reading directly form its path in the fragment code.

Did you try this?

Alfaplus
  • 1,713
  • 2
  • 19
  • 29
0

I see two solutions:

  1. Since you are taking a picture in one Activity and want to get it in a Fragment (which has an Activity), you could put the bitmap path on bundle on the Take Picture activity (bundle.putString("bitmapPath", bitmap.getPath())) and read this bundle on the Show Picture Activity Fragment (getActivity().getExtras().get("bitmapPath")).
  2. You could use a public static variable to keep bitmap path after you saving it.
Leonardo Cardoso
  • 1,164
  • 2
  • 12
  • 22