antew / RedditInPictures

An image browser for Reddit for Android 2.2+
Apache License 2.0
9 stars 4 forks source link

BadParcelableException in ImageDetailActivity when swiping through images #162

Closed antew closed 10 years ago

antew commented 10 years ago
04-28 02:20:45.092    4508-4508/com.antew.redditinpictures.pro E/AndroidRuntime﹕ FATAL EXCEPTION: main
    android.os.BadParcelableException: ClassNotFoundException when unmarshalling: com.antew.redditinpictures.library.model.reddit.PostData
            at android.os.Parcel.readParcelableCreator(Parcel.java:2105)
            at android.os.Parcel.readParcelable(Parcel.java:2055)
            at android.os.Parcel.readValue(Parcel.java:1971)
            at android.os.Parcel.readMapInternal(Parcel.java:2255)
            at android.os.Bundle.unparcel(Bundle.java:223)
            at android.os.Bundle.getSparseParcelableArray(Bundle.java:1237)
            at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:872)
            at android.support.v4.app.FragmentManagerImpl.performPendingDeferredStart(FragmentManager.java:834)
            at android.support.v4.app.Fragment.setUserVisibleHint(Fragment.java:841)
            at android.support.v4.app.FragmentStatePagerAdapter.setPrimaryItem(FragmentStatePagerAdapter.java:152)
            at android.support.v4.view.ViewPager.populate(ViewPager.java:1066)
            at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:550)
            at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:509)
            at android.support.v4.view.ViewPager.dataSetChanged(ViewPager.java:908)
            at android.support.v4.view.ViewPager$PagerObserver.onChanged(ViewPager.java:2819)
            at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
            at android.support.v4.view.PagerAdapter.notifyDataSetChanged(PagerAdapter.java:276)
            at com.antew.redditinpictures.library.adapter.CursorPagerAdapter.swapCursor(CursorPagerAdapter.java:55)
            at com.antew.redditinpictures.library.ui.ImageDetailActivity.onLoadFinished(ImageDetailActivity.java:398)
            at com.antew.redditinpictures.library.ui.ImageDetailActivity.onLoadFinished(ImageDetailActivity.java:59)
            at android.support.v4.app.LoaderManagerImpl$LoaderInfo.callOnLoadFinished(LoaderManager.java:427)
            at android.support.v4.app.LoaderManagerImpl$LoaderInfo.onLoadComplete(LoaderManager.java:395)
            at android.support.v4.content.Loader.deliverResult(Loader.java:104)
            at android.support.v4.content.CursorLoader.deliverResult(CursorLoader.java:73)
            at android.support.v4.content.CursorLoader.deliverResult(CursorLoader.java:35)
            at android.support.v4.content.AsyncTaskLoader.dispatchOnLoadComplete(AsyncTaskLoader.java:223)
            at android.support.v4.content.AsyncTaskLoader$LoadTask.onPostExecute(AsyncTaskLoader.java:61)
            at android.support.v4.content.ModernAsyncTask.finish(ModernAsyncTask.java:461)
            at android.support.v4.content.ModernAsyncTask.access$500(ModernAsyncTask.java:47)
            at android.support.v4.content.ModernAsyncTask$InternalHandler.handleMessage(ModernAsyncTask.java:474)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5103)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)
antew commented 10 years ago

I figured out how to reproduce at least one instance of this, and the changes in https://github.com/antew/RedditInPictures/commit/fa93d5ed8ee32b01720a569a8ac20e0c185604fb do stop the crash.

  1. Launch the app
  2. Go to a subreddit (I used /r/gifs)
  3. Drill down to the ViewPager
  4. Hit the Home button
  5. Kill the app through DDMS
  6. Re-open the app through the recent apps menu
  7. Crash happens here.