0

I want to pass a class object to a Fragment. I know to pass the class objects then we have to implement serializable or parcelable. But I can not extend or implement compiled libraries or jar files objects to parcelable or serializable. Then how can I pass these type of objects to a Fragment?

Example: If I have Button class object in one Fragment and pass it to another Fragment, then how to do this?

Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98

1 Answers1

2

That's weird that you want to pass an object of a compiled jar or libraries. But anyway, you might try getting the necessary values from the object you want to pass to another Fragment. Then you might create your own class and take an instance of your class to store the values you need there.

Then make the class Parcelable which you've created and then pass it to the Fragment you want. You'll get plenty of resource about how you can pass objects from one Fragment to another.

Hope that helps!

Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98