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 8341685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:33:29+00:00 2026-06-09T05:33:29+00:00

I am using the Sherlock ActionBar library and I have a SherlockFragmentActivity implementing ActionBar.TabListener

  • 0

I am using the Sherlock ActionBar library and I have a SherlockFragmentActivity implementing ActionBar.TabListener (for my tabs) and I have 3 tabs…each being a SherlockFragment. When I rotate, the entire Activity is recreated and I lose all variables declared in my onCreate within the Fragment. How would I go about fixing this?

I figured I should be using fragments as tabs instead of activities…is this wrong?

EDIT: I should mention that my current workaround is to have static Lists in the Tab Activity and have the fragment push stuff to those lists on onPause (and get stuff back from them on onResume). I REALLY don’t like doing this and I know there has to be a better way.

Also, regarding if(savedInstanceState==null), I’ve tried that and it doesn’t seem to work. I think it’s because the Activity that holds my Fragments is being recreated and the tabs need to be recreated.

  • 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-09T05:33:31+00:00Added an answer on June 9, 2026 at 5:33 am

    There’s a method called setRetainInstance() in the Fragment class, that you need to set to true. That’ll save the instance of your fragments, and you can then check for any saved instances in onCreate().

    More info available here:
    http://developer.android.com/reference/android/app/Fragment.html

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

Sidebar

Related Questions

Using ActionBar Sherlock to implements tabs, I have a new TabsAdapter object declared and
I have an ActionBar using ActionBar Sherlock where I need it to display overflow
I am new to using the Sherlock ActionBar and I have make it run
I am using ActionBarSherlock and have an ActionBar with navigation tabs in it. I
i'm using actionbar sherlock/fragments with my app my problem is that i need to
So I'm trying to style the tabs of my Actionbar, which I've implemented using
In my application i am using Sherlock Fragment Pager and i want to create
I'm trying to build my project using ANT. My project uses ActionbarSherlock, and Roboguice-Sherlock.
Using android 2.3.3, I have a background Service which has a socket connection. There's
Using Android TelephonyManager an application can obtain the state of data activity over the

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.