The code
SngList.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView a, View v, int position, long id) {
In
According to https://forums.bignerdranch.com/t/challenge-saving-state-notserializableexception-error/8018/5 you should implement or extend some class from Parcelable
.
In my case I had a DialogFragment with an interface MyCallback extending Serializable. In newInstance(MyCallback callback)
builder I used:
Bundle args = new Bundle();
args.putSerializable(key, callback);
that led to an exception.
Then I rewrote MyCallback to extend Parcelable
and also added some methods to a callback when invoked this DialogFragment. At least, it doesn't crash on Home button or screen off.
Also changed to:
Bundle args = new Bundle();
args.putParcelable(key, callback);