Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9121125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:47:22+00:00 2026-06-17T05:47:22+00:00

I have a viewpager with at least 3 fragments. If the user inputs data

  • 0

I have a viewpager with at least 3 fragments. If the user inputs data into A, then B, then C and goes back to A that data is lost from A.

I think I read somewhere that this has to do with memory management and since fragments only connect to or store adjacent fragments it’s killing A when I get too far away.
However I wish to retain the life of each fragment even were I to have >3.

How can I tell the viewpager to never kill a fragment unless explicitly directed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:47:23+00:00Added an answer on June 17, 2026 at 5:47 am

    use

    setOffscreenPageLimit(int limit) 
    

    on the ViewPager object.

    From the documentation:

    [It set]s the number of pages that should be retained to either side of the current page in the view hierarchy in an idle state.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ViewPager with 3 fragments into it. Everything works fine with two
I have a ViewPager that loads images from a remote server. My problem is,
I have a ViewPager hooked up to a FragmentPagerAdapter that's displaying three fragments. The
I have a viewpager that pages through fragments. My FragmentPagerAdapter subclass creates a new
Are DB close errors dangerous? I have a viewpager with 3 fragments that all
I have a ViewPager with multiple fragments. In one Fragment I play audio. When
I have a FragmentActivity using a ViewPager to serve several fragments. Each is a
I have a ViewPager, and FragmentPagerAdpater and 3 Fragments to implement an tab swipe
I have a viewpager that uses a PagerTabStrip to indicate the current page. However,
I have a ViewPager of images that I want to be able to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.