ActionBarSherlock + ViewPager caching more then just prev/next view

on the page:
onCreate called for two tabs each time one tab is selected

there is explained how the ABS(actually ViewPager) is working in order for ViewPager to be able to do a scrolling.
It is clear that at least a prev/next page need all to be created at the same time.

  • android - save image into gallery
  • FileNotFoundException on Android version > 2.3
  • Fill fields in webview automatically
  • How to assert inside a RecyclerView in Espresso?
  • Knowing when Edit text is done being edited
  • Android Multipart POST to Google App Engine not working
  • Would it be possible to “cache” more than just prev/next Views(Fragments), in a way:

    1. I am on Page 1 and there I have a network call to fetch some data(doing this in Activity, not in Fragment – btw. is this OK?)

    2. switch to Page 2, and then

    3. switch to Page 3, and then

    4. switch to Page 1 = Here my page is recreated (using some caching though, BUT, I do not need any recreation if possible)

    So, it would be nice to cache all the pages. How to accomplish this If possible in current version (4), or this would be some new feature?

    Or even better question, how to postpond/disable destroying of views?

    Related posts:

    Use Dagger modules without the “injects” directive
    Android: How to get Refresh Token by Google Sign-In API?
    Android 5.0 - ProgressBar cannot be displayed over a Button
    No Sound coming from Android Emulator
    Implement a timeout in BluetoothSocket inputstream.read() in Android
    Horizontal progress bar width in actionbar
  • Animated background like Timely alarm clock app
  • Authenticating with Active Directory via Kerberos
  • How to highlight row in ListView in Android?
  • Sharing and persisting data between multiple Android applications
  • Android: Return search query to current activity
  • understanding onTrimMemory( int level )
  • One Solution collect form web for “ActionBarSherlock + ViewPager caching more then just prev/next view”

    I suppose It might be useful to someone else, as pointed on website
    http://storkme.org/2011/12/tabs-done-right-viewpager-and-fragments/

    There is already a method which allows you to predefine number of “cached” pages the ViewPager will save from recreating.

    mViewPager.setOffscreenPageLimit(3);
    

    Thanks Jake for reminding me to do a different G search 🙂

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.