0

I have a fragment that contains 3 different ImageButtons, that links to a new fragment with some information.

All info.fragments have the same layout, only different is the image and text.

I would like to reuse the layout on the info.fragment and pass the image and text value instead. ex. StarImage and StarText and the same with MusicImage and MusicText.

This is my first project in AndroidStudio.

startFragment and 2 info.Fragment

Anna
  • 1
  • 1

1 Answers1

0

You can pass a int (or a Enum index) to your destination Fragment as a Bundle and retrieve it in your onCreateView to set your text and image according to the received number.

Check out this answer to see an example: https://stackoverflow.com/a/21486451/11407290

GuilhermeMagro
  • 321
  • 1
  • 10