hmm..I got the clues..will try with these..thanks On May 18, 5:38 pm, Kostya Vasilyev <[email protected]> wrote: > Yourcodeis pretty much boilerplate, I don't see anything wrong. > > Perhaps the state you're getting in restore is not the state you saved? > > Do you have views that are dynamically instantiated? > > Are all views in the activity assigned unique id values? > > Other than that, I'd try debugging with framework sources. > > -- Kostya > > 18.05.2011 15:37, Namrata пишет: > > > > > yes I am using one custom ViewGroup& I am handling saveInstanceState > > & restoreInstanceState in it.(I just forgot to think about this custom > > view). So yup I understand the probability is the exception comes > > here. I checked mycode, it has only 1 state variable to store. So no > > miss-order handling is there. When I write to parcel its size is 660& > > when read it size is 1013. here is thecodesnippet > > > protected Parcelable onSaveInstanceState() { > > final SavedState state = new > > SavedState(super.onSaveInstanceState()); > > state.currentState = this.currentState; > > return state; > > } > > > /** > > * Restore the previous saved current screen > > */ > > @Override > > protected void onRestoreInstanceState(Parcelable state) { > > SavedState savedState = (SavedState) state; > > super.onRestoreInstanceState(savedState.getSuperState()); > > if (savedState.currentScreen != -1) { > > currentState = savedState.currentState; > > } > > } > > > // ========================= INNER CLASSES > > ============================== > > > public interface onViewChangedEvent { > > void onViewChange(int currentViewIndex); > > } > > > /** > > * A SavedState which save and load the current screen > > */ > > public static class SavedState extends BaseSavedState { > > int currentState = -1; > > > /** > > * Internal constructor > > * > > * @param superState > > */ > > SavedState(Parcelable superState) { > > super(superState); > > } > > > /** > > * Private constructor > > * > > * @param in > > */ > > private SavedState(Parcel in) { > > super(in); > > Log.d("------------", "parcelsize() in "+in.dataSize()); > > currentState = in.readInt(); > > } > > > /** > > * Save the current screen > > */ > > @Override > > public void writeToParcel(Parcel out, int flags) { > > super.writeToParcel(out, flags); > > out.writeInt(currentState); > > Log.d("------------", "parcelsize() out > > "+out.dataSize()); > > } > > > /** > > * Return a Parcelable creator > > */ > > public static final Parcelable.Creator<SavedState> CREATOR = new > > Parcelable.Creator<SavedState>() { > > public SavedState createFromParcel(Parcel in) { > > return new SavedState(in); > > } > > > public SavedState[] newArray(int size) { > > return new SavedState[size]; > > } > > }; > > } > > > On May 18, 3:18 pm, Kostya Vasilyev<[email protected]> wrote: > >> The error happens while restoring view states (as already pointed out by > >> Zsolt), do you have any custom views in this activity? Do they have > >> methods to save / restore instance state? > > >> It's hard to be more specific. Since it happens on your phone, you could > >> try debugging this into the framework sources. > > >> -- Kostya > > >> 18.05.2011 13:48, Namrata пишет: > > >>> Latest observation, if I am on activity A& then I kill app with app > >>> killer application& after that I try to relaunch my app, generally > >>> here above mentioned exception comes. > >>> On May 18, 2:37 pm, Namrata<[email protected]> wrote: > >>>> @Kostya, thanks for replying...I am not overriding > >>>> onSaveInstanceState()& onRestroreInstanceState() methods. So whatever > >>>> super ie Activity class has it is getting executed. Thats why I am > >>>> surprised that I am using Intent extras for my purpose and not > >>>> touching above 2 methods still its throwing exception in that method. > >>>> Any clue? > >>>> On May 18, 2:18 pm, Kostya Vasilyev<[email protected]> wrote: > >>>>> Thetypecodeis a prefix in the data stream that tells Parcelable the > >>>>> typeof data that follows. > >>>>> See Parcel.java, method readValue(), around lines 1700-1800. > >>>>> All the codes are small numbers, between -1 and 24. Thecodein your > >>>>> logcat is much larger. > >>>>> This can be caused by data being read in a different order than it's > >>>>> been written. For example: > >>>>> parcel.writeInt(...) > >>>>> parcel.writeString() > >>>>> ... > >>>>> parcel.readString() > >>>>> parcel.readInt() > >>>>> It can also be caused by data corruption of some sort, for some reason. > >>>>> You don't seem to be using parcel directly, but still, maybe this can > >>>>> give you some more ideas. > >>>>> There is a call to Activity.onRestoreInstanceState, so there is a > >>>>> parcelable (bundle) involved here. > >>>>> -- Kostya > >>>>> 18.05.2011 12:49, Namrata пишет: > >>>>>> @Zsolt thanks for replying..but I didn't understand what are you > >>>>>> saying, can u plz explain it in detail? > >>>>>> On May 18, 12:42 pm, Zsolt Vasvari<[email protected]> wrote: > >>>>>>> The stack trace you are showing doesn't seem to involve your intent > >>>>>>> extras. It appears to be restoring the state of your screen when it's > >>>>>>> crashing. > >>>>>>> On May 18, 3:35 pm, Namrata<[email protected]> wrote: > >>>>>>>> Hi, > >>>>>>>> I have one activity A with requires few values passed in intent. > >>>>>>>> Those > >>>>>>>> values are oftypeboolean& int array. I am passing these these > >>>>>>>> values from activity B in intent as intent.putExtra(key1, boolean)& > >>>>>>>> intent.putExtra(key2, int[]). In activity A I am reading it as > >>>>>>>> Intent i = getIntent(); > >>>>>>>> Bundle b = i.getExtras(); > >>>>>>>> boolean flag = b.getBoolean(key1); > >>>>>>>> int[] array = b.getIntArray(key2); > >>>>>>>> It works perfect all the time but there is one case where it throws > >>>>>>>> exception > >>>>>>>> java.lang.RuntimeException: Parcel android.os.Parcel@4611b4a8: > >>>>>>>> Unmarshallingunknowntypecode2131427514 at offset 456 > >>>>>>>> at > >>>>>>>> android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > >>>>>>>> 2787) > >>>>>>>> at > >>>>>>>> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: > >>>>>>>> 2803) > >>>>>>>> at android.app.ActivityThread.access$2300(ActivityThread.java:135) > >>>>>>>> at android.app.ActivityThread$H.handleMessage(ActivityThread.java: > >>>>>>>> 2136) > >>>>>>>> at android.os.Handler.dispatchMessage(Handler.java:99) > >>>>>>>> at android.os.Looper.loop(Looper.java:144) > >>>>>>>> at android.app.ActivityThread.main(ActivityThread.java:4937) > >>>>>>>> at java.lang.reflect.Method.invokeNative(Native Method) > >>>>>>>> at java.lang.reflect.Method.invoke(Method.java:521) > >>>>>>>> at com.android.internal.os.ZygoteInit > >>>>>>>> $MethodAndArgsCaller.run(ZygoteInit.java:868) > >>>>>>>> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) > >>>>>>>> at dalvik.system.NativeStart.main(Native Method) > >>>>>>>> Caused by: java.lang.RuntimeException: Parcel > >>>>>>>> android.os.Parcel@4611b4a8:Unmarshallingunknowntypecode2131427514 > >>>>>>>> at offset 456 > >>>>>>>> at android.os.Parcel.readValue(Parcel.java:1838) > >>>>>>>> at android.os.Parcel.readSparseArrayInternal(Parcel.java:2037) > >>>>>>>> at android.os.Parcel.readSparseArray(Parcel.java:1493) > >>>>>>>> at android.os.Parcel.readValue(Parcel.java:1828) > >>>>>>>> at android.os.Parcel.readMapInternal(Parcel.java:2008) > >>>>>>>> at android.os.Bundle.unparcel(Bundle.java:208) > >>>>>>>> at android.os.Bundle.getSparseParcelableArray(Bundle.java:1167) > >>>>>>>> at > >>>>>>>> com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java: > >>>>>>>> 1493) > >>>>>>>> at android.app.Activity.onRestoreInstanceState(Activity.java:850) > >>>>>>>> at > >>>>>>>> android.app.Activity.performRestoreInstanceState(Activity.java:822) > >>>>>>>> at > >>>>>>>> android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java: > >>>>>>>> 1142) > >>>>>>>> at > >>>>>>>> android.app.ActivityThread.performLaunchActivity(ActivityThread.java: > >>>>>>>> 2765) > >>>>>>>> ... 11 more > >>>>>>>> I dont have exact reproducible steps for this, but this is very > >>>>>>>> annoying, what to do? > >>>>>>>> Thanks in advance > >>>>> -- > >>>>> Kostya Vasilyev --http://kmansoft.wordpress.com > >> -- > >> Kostya Vasilyev --http://kmansoft.wordpress.com > > -- > Kostya Vasilyev --http://kmansoft.wordpress.com
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

