talenguyen / PrettyBundle

Deprecated: this will be maintained under https://github.com/tikivn/android-template/tree/master/intents

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@Extra doesn't work with fragments

ArthurSav opened this issue · comments

I get this error when i add @extra to a fragment
Error:(15, 13) error: Only support Activity, Fragment and Service

Could you please provide some code.

public class MyFragment extends BaseFragment {

   @Extra
    Checkin checkin; //it's parcelable

    public static MyFragment newInstance(Checkin checkin) {
        MyFragment fragment = Fragments.createMyFragment(checkin);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        PrettyBundle.inject(this);
    }
}

Note that it's a v4 fragment.

I also tried this lib which kinda does the same thing for fragments and it works https://github.com/sockeqwe/fragmentargs

Did you use gradle or Jar?

gradle

compile 'com.github.talenguyen:prettybundle:1.0.2'
compile 'com.github.talenguyen:prettybundleprocessor:1.0.2'

Fixed in version 1.0.3