K
K
kirawa2018-09-12 08:23:20
Android
kirawa, 2018-09-12 08:23:20

How to get rid of ClassCastException?

Good afternoon. I have one activity with many fragments in it, where I initialize various interfaces:

mCallbacks = (ICallbacks)getFragmentManager().findFragmentById(R.id.contentMain);

everything works fine, but when the user is called or he is not in the application for a long time, then when initialized in R.id.contentMain, there are completely different fragments that are the very first in the stack from the main activity.
Something with saving the state. Please help with advice or a link.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question