Material-BottomNavigation icon indicating copy to clipboard operation
Material-BottomNavigation copied to clipboard

Switching between fragments with data loading in the fragments crushes the app

Open pkanyerezi opened this issue 8 years ago • 0 comments

Hey,

Am using this library with tabbed fragments. These fragments receive online data using retrofit. The problem is when i launch the app and i immediately switch from the first fragment to the next fragment from the bottomoNavigation and the first fragment was still loading data the app crushes at the point where i inititialize the adaptar.

mAdapter = new CardViewAdapter(getContext(), R.layout.card_view, roundboboffers.getResponse().getDestinations());

But when i wait for the fragment to load data first it works fine.

i've tried to do this in the onCreateView() but all in the vein

    if (v == null) {
        v = inflater.inflate(R.layout.activity_main_hometest, container, false);
    }else{
        ((ViewGroup)v.getParent()).removeView(v);
    }

pkanyerezi avatar Jun 21 '17 13:06 pkanyerezi