I have a simple Activity with TabLayout, ViewPager and 2 Fragments in it. Here\'s my Activity:
public class ManagementCompanyOverviewActivity extends BaseAct
From Activity or ViewPager
Bundle bundle = new Bundle();
bundle.putParcelable(Keys.KEY_ITEM, cardResult);
CardItemFragment cardItemFragment = new CardItemFragment();
cardItemFragment.setArguments(bundle);
From Fragment
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
getBundle();
}
private void getBundle() {
bundle = getArguments();
if (null != bundle) {
if (bundle.containsKey(Keys.KEY_ITEM)) {
cardResult = bundle.getParcelable(Keys.KEY_ITEM);
}
}
}