Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RuntimeException when unmarshalling data #51

Merged
merged 2 commits into from Nov 20, 2013
Merged

Fix RuntimeException when unmarshalling data #51

merged 2 commits into from Nov 20, 2013

Conversation

kquan
Copy link
Contributor

@kquan kquan commented Nov 14, 2013

I noticed a bug when using the SlideExpandableListView. The reproduction of the bug is as follows:

  1. In Android OS settings, go under Developer options and enable "Do not keep activities"
  2. In Android app, navigate until you get to an activity that uses the SlideExpandableListView
  3. (Optional) I enabled the expansion on the list view
  4. Jump directly out of the app (i.e., press home key)
  5. Open the app again through the launcher or task switch

This will cause an exception similar to the following:
0 java.lang.RuntimeException: Unable to start activity ComponentInfo{REMOVEDBYAUTHOR}: java.lang.RuntimeException: Parcel android.os.Parcel@425119b: Unmarshalling unknown type code 28 at offset 452
1 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
2 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
3 at android.app.ActivityThread.access$600(ActivityThread.java:141)
4 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
5 at android.os.Handler.dispatchMessage(Handler.java:99)
6 at android.os.Looper.loop(Looper.java:137)
7 at android.app.ActivityThread.main(ActivityThread.java:5103)
8 at java.lang.reflect.Method.invokeNative(Native Method)
9 at java.lang.reflect.Method.invoke(Method.java:525)
10 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
11 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12 at dalvik.system.NativeStart.main(Native Method)
13 Caused by: java.lang.RuntimeException: Parcel android.os.Parcel@425119b: Unmarshalling unknown type code 28 at offset 452
14 at android.os.Parcel.readValue(Parcel.java:2038)
15 at android.os.Parcel.readSparseArrayInternal(Parcel.java:2284)
16 at android.os.Parcel.readSparseArray(Parcel.java:1693)
17 at android.os.Parcel.readValue(Parcel.java:2028)
18 at android.os.Parcel.readMapInternal(Parcel.java:2255)
19 at android.os.Bundle.unparcel(Bundle.java:223)
20 at android.os.Bundle.getSparseParcelableArray(Bundle.java:1237)
21 at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:861)
22 at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
23 at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
24 at android.support.v4.app.FragmentManagerImpl.dispatchCreate(FragmentManager.java:1872)
25 at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:215)

After debugging, I noticed this issue is similar to that described by this SO article:
http://stackoverflow.com/questions/19672772/parcel-unmarshalling-unknown-type-code

It looks like the code in SavedState has the code for writing and reading the parcel reversed. This patch resolves this problem.

@tjerkw
Copy link
Owner

tjerkw commented Nov 20, 2013

I supposed you tested this. So i'll me lazy and merge it

tjerkw added a commit that referenced this pull request Nov 20, 2013
Fix RuntimeException when unmarshalling data
@tjerkw tjerkw merged commit a99e817 into tjerkw:master Nov 20, 2013
@MrDoLoop
Copy link

Can you add new features?
When the last item in the list is expended, is it possiable that smoothly scroll up some distance, in order to let expandable area visible.

Thanks

@kquan
Copy link
Contributor Author

kquan commented Dec 2, 2013

@MrDoLoop I had a similar requirement but I was able to get around it without editing the library code by adding an OnClickListener on the view and then using a ViewTreeObserver to scroll up the list as needed if the height of the expanded list item exceeds the bottom of the list.

@MrDoLoop
Copy link

MrDoLoop commented Dec 2, 2013

Thanks so much for your attention.
Could you share me some pieces of snippet? I never used ViewTreeObserver
before

Appreciate your attention.

2013/12/2 Kevin Quan notifications@github.com

@MrDoLoop https://github.com/MrDoLoop I had a similar requirement but I
was able to get around it without editing the library code by adding an
OnClickListener on the view and then using a ViewTreeObserver to scroll up
the list as needed if the height of the expanded list item exceeds the
bottom of the list.


Reply to this email directly or view it on GitHubhttps://github.com//pull/51#issuecomment-29593168
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants