I want to pass a complex object between activity and fragments as well as fragments and fragments. Currently, the main activity create a fragment input object and set that as a
In this case you can use static holder (it's a bit similar to a singleton pattern).
Create a new class
public class Holder
{
private static FragmentInput input = null;
public static void setInput(FragmentInput value) { this.input = value; }
public static FragmentInput getInput() { return input; }
}
In your main activity, after you create your new FragmentInput object hold it on the Holder
Holder.setInput(input);
And you can access it anywhere, simply call
FragmentInput myInput = Holder.getInput();