I have class mentioned below:
public class JsonHistoryList extends ArrayList<JsonHistory> implements Serializable{}
I wish to pass it through intent using
timerService.putExtra(TimerService.ACTIVITY_LIST_ARG, activities);
But after I receive it (way below)
JsonHistoryList temp = (JsonHistoryList) intent.getSerializableExtra(TimerService.ACTIVITY_LIST_ARG);
in my service it gives me exception:
Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to com.epstim.captime.jsonmodel.JsonHistoryList
I don't understand why java can't handle that operation.
I've changed my code in service to:
ArrayList<JsonHistory> temp = (ArrayList<JsonHistory>) intent.getSerializableExtra(TimerService.ACTIVITY_LIST_ARG);
activities.addAll(temp);
And it worked.
JsonHistoryList
? – Disparitytemp.getClass().toString()
and tell us what it is. – Quinonoid