android - ClassCastException in Parcelable, but perhaps deeper problems? -


i have field looks in class called game

private arraylist<question>[] questions; 

i writing in this

public void writetoparcel(parcel parcel, int flags){     ...     parcel.writearray(questions);     ... } 

and retrieving this

private game(parcel in) {     ...     questions = (arraylist<question>[]) in.readarray(question.class.getclassloader());     ... } 

for reason, works when know activity's ondestroyed() called (when orientation changed portrait landscape or vice versa), works fine , data passed.

however, when app has been paused while (i.e. user hits home , moves on random things), dies later being "unable cast object[] arraylist[]".

logcat:

05-18 02:52:40.967 i/activitymanager(401): start u0 {act=android.intent.action.main cat=[android.intent.category.launcher] flg=0x10200000 cmp=com.example.app/.ui.mainactivity} pid 649 05-18 02:52:51.053 w/activitymanager(401): activity idle timeout activityrecord{412389c8 u0 com.example.app/.ui.mainactivity} 05-18 03:00:29.857 i/windowstate(401): win death: window{41238b08 u0 com.example.app/com.example.app.ui.mainactivity} 05-18 03:00:29.865 i/activitymanager(401): process com.example.app (pid 29139) has died. 05-18 09:00:53.402 i/activitymanager(401): start u0 {act=android.intent.action.main cat=[android.intent.category.launcher] flg=0x10200000 cmp=com.example.app/.ui.mainactivity bnds=[373,630][533,830]} pid 649 05-18 09:00:53.465 i/activitymanager(401): start proc com.example.app activity com.example.app/.ui.mainactivity: pid=9148 uid=10117 gids={50117, 3003, 1028} 05-18 09:00:53.949 e/androidruntime(9148): java.lang.runtimeexception: unable start activity componentinfo{com.example.app/com.example.app.ui.mainactivity}: java.lang.classcastexception: java.lang.object[] cannot cast java.util.arraylist[] 05-18 09:00:53.949 e/androidruntime(9148):  @ com.example.app.model.game.<init>(game.java:241) 05-18 09:00:53.949 e/androidruntime(9148):  @ com.example.app.model.game.<init>(game.java:235) 05-18 09:00:53.949 e/androidruntime(9148):  @ com.example.app.model.game$1.createfromparcel(game.java:228) 05-18 09:00:53.949 e/androidruntime(9148):  @ com.example.app.model.game$1.createfromparcel(game.java:1) 05-18 09:00:53.949 e/androidruntime(9148):  @ com.example.app.ui.mainactivity.oncreate(mainactivity.java:212) 05-18 09:00:53.949 w/activitymanager(401):   force finishing activity com.example.app/.ui.mainactivity 05-18 09:00:54.512 w/activitymanager(401): activity pause timeout activityrecord{412389c8 u0 com.example.app/.ui.mainactivity} 05-18 09:00:59.981 i/activitymanager(401): process com.example.app (pid 9148) has died. 

can explain what's happening? looks frees memory activity taking , objects don't exist anymore. correct?


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -