Open Kolokodess opened 9 years ago
Is it possible that your fragment is being created again when your main activity resumes, such that onCreateView()
is called and mFlipView
is re-created? Can you post the code you use to create and add your fragment?
BTW, why are you calling super.onCreate()
in onCreateView()
? And, you don't need to call mFlipView.removeAllViews()
, because it will be called in mFlipView.setAdapter()
.
The adapter of a flipview is set onCreate. Everything works fine. The user is meant to select some items on another activity which would update the items on the flipview. I implemented this by changing the adapter of the flipView when onResume is called and the dismiss activity is the selectionActivity. The code is executed but it does not reflect on the flipView items.
What i do on onCreate
@Override 'public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); View rootView = inflater.inflate(R.layout.flip_main, container, false); mFlipView = (FlipView) rootView.findViewById(R.id.flip_view);
what is called after the user makes selection
FlipAdapterTest mAdapter = new FlipAdapterTest(getActivity(), getHomeItems(), getFragmentManager()); mFlipView.removeAllViews(); mFlipView.setAdapter(mAdapter);