MDoe MDoe - 8 months ago 63
Android Question

Set custom data type in Argument

I got a little problem in Android. I am creating a App and want to pass a Object to my Fragment.
I'm searching for a way to pass a custom Object to my Fragment, something like:

Fragment frag = new myFragment();
Bundle args = new Bundle();
args.put("Arg1", myObject);

Is there a way to do something like that?


Answer Source

Getters and setters are good for this job rather than using arguments when you pass object between two fragments

Answer is given in this link Android: Passing Objects Between Fragments