S
S
Strange2014-03-18 15:47:34
Android
Strange, 2014-03-18 15:47:34

Working with Loader and ResultReceiver - how to fix the error?

There is an activity and a service that receives data via REST.
Activity implements LoaderManager.LoaderCallbacks and MyResultReceiver.Receiver (worse than the usual approach).
There is a problem when turning the device, you need to save the current receiver, I do this:

if (savedInstanceState != null) {
  _receiver = savedInstanceState.getParcelable(Extra.RECEIVER);
} else {
  _receiver = new MyResultReceiver(new Handler());
}
_receiver.setReceiver(this);

It works, but if the activity was unavailable for a long time, I get an error when casting, i.e. with savedInstanceState the base ResultReceiver comes, and not my MyResultReceiver.
Looking for a solution.

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