Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getArguments().getParcelable doesn't work with FragmentTransitionLauncher #8

Closed
TheLester opened this issue Sep 13, 2015 · 3 comments
Closed

Comments

@TheLester
Copy link

I am using FragmentTransitionLauncher with shared resource(image) from one fragment to another:

  final MoreAppInfoFragment toFragment = MoreAppInfoFragment.newInstance();
  FragmentTransitionLauncher.with(getActivity()).image(myBtimap).
  from(iconHolder).prepare(toFragment);

I noticed that FragmentTransitionLauncher.prepare() method creates new Bundle obj sets him to fragment:

   public void prepare(android.support.v4.app.Fragment toFragment) {
   Bundle transitionBundle = TransitionBundleFactory.createTransitionBundle(this.context,
   this.fromView, this.bitmap);
   toFragment.setArguments(transitionBundle);}

So instead of creating new Bundle, i get existing and put my Parcelable like this:

    toFragment.getArguments().putParcelable(MoreAppInfoFragment.APP_INFO_OBJ,    
    Parcels.wrap(new AppInfo()));

And then start my fragment:

     getFragmentManager().beginTransaction().replace(R.id.fragmentContainer, 
     toFragment).addToBackStack(null).commit();

And finally in my MoreAppInfoFragment onViewCreated i getArguments and it returns null:

    public void onViewCreated(View view, Bundle savedInstanceState) {
    AppInfo currentApp = 
    Parcels.unwrap(getArguments().getParcelable(APP_INFO_OBJ));//getArguments() = null}
@takahirom
Copy link
Owner

Thank you for reporting.
I tried it , but not reproduce. Please tell me how to reproduce.
40a043d

@TheLester
Copy link
Author

@takahirom Never mind,It was my bug, but anyway it would be good to mention in documentation that developer can't create new Bundle object and should use existing by getArguments()

@takahirom
Copy link
Owner

@TheLester
Thank you for feed back.
I will add that to README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants