3

I am using Android annotation in Fragment class but @AfterViews annotated method is not getting called. Here is the code:

@EFragment(R.layout.fragment_onboarding_base)
public class AddEntityFragment extends Fragment {

@ViewById ViewPager onBoardingViewPager;

public static AddEntityFragment newInstance() {
    AddEntityFragment addEntityFragment = new AddEntityFragment();
    return addEntityFragment;
}

@AfterViews
void afterViewCreated(){
    onBoardingViewPager.setAdapter(new CustomOnBoardingPagerAdapter(getChildFragmentManager(), getContext()));
}
}

What I am doing wrong here? I checked my debug point it's not going inside to afterViewCreated() method. Any help would be appreciable.

Prerna Rawat
  • 151
  • 1
  • 12

1 Answers1

3

The problem is that you are not using the generated class. You should do this instead:

AddEntityFragment fragment = AddEntityFragment_.builder().build();
// add the fragment in a transaction
WonderCsabo
  • 11,947
  • 13
  • 63
  • 105