diff --git a/src/android/support/v4/app/ClassloaderWorkaroundFragmentStatePagerAdapter.java b/src/android/support/v4/app/ClassloaderWorkaroundFragmentStatePagerAdapter.java new file mode 100644 index 00000000..c86e16d7 --- /dev/null +++ b/src/android/support/v4/app/ClassloaderWorkaroundFragmentStatePagerAdapter.java @@ -0,0 +1,39 @@ +package android.support.v4.app; + +// http://code.google.com/p/android/issues/detail?id=37484 +// Thanks for your amazing code quality, Google. + +import android.os.Bundle; +import android.view.ViewGroup; + +public class ClassloaderWorkaroundFragmentStatePagerAdapter extends + FragmentStatePagerAdapter { + + public ClassloaderWorkaroundFragmentStatePagerAdapter(FragmentManager fm) { + super(fm); + // TODO Auto-generated constructor stub + } + + @Override + public Fragment getItem(int arg0) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object instantiateItem(ViewGroup container, int position) { + Fragment f = (Fragment) super.instantiateItem(container, position); + Bundle savedFragmentState = f.mSavedFragmentState; + if (savedFragmentState != null) { + savedFragmentState.setClassLoader(f.getClass().getClassLoader()); + } + return f; + } + + @Override + public int getCount() { + // TODO Auto-generated method stub + return 0; + } + +} diff --git a/src/org/fox/ttrss/ArticlePager.java b/src/org/fox/ttrss/ArticlePager.java index fed7f01e..05f794ce 100644 --- a/src/org/fox/ttrss/ArticlePager.java +++ b/src/org/fox/ttrss/ArticlePager.java @@ -13,6 +13,7 @@ import android.content.SharedPreferences; import android.os.BadParcelableException; import android.os.Bundle; import android.preference.PreferenceManager; +import android.support.v4.app.ClassloaderWorkaroundFragmentStatePagerAdapter; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; @@ -38,7 +39,7 @@ public class ArticlePager extends Fragment { private Feed m_feed; private SharedPreferences m_prefs; - private class PagerAdapter extends FragmentStatePagerAdapter { + private class PagerAdapter extends ClassloaderWorkaroundFragmentStatePagerAdapter { public PagerAdapter(FragmentManager fm) { super(fm);