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

  • Home
  • SEARCH
  • 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 7158227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:01:43+00:00 2026-05-28T13:01:43+00:00

i am new to android.i have one single activity with main.xml file. Now, i

  • 0

i am new to android.i have one single activity with main.xml file. Now, i have one scroll view in that main.xml file.when i run my application in portrait mode and when i go to the bottom of the scroll view and than when i change my application state to the landscape mode than i go to the top of the scroll view..that means when we switch between portrait to landscape or vice versa the activity is recalled. so need to save the application state in portrait and restore in landscape. so any solution of it?
thanks in advance
Aamirkhan I.

  • 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-05-28T13:01:44+00:00Added an answer on May 28, 2026 at 1:01 pm

    The documentation does a decent job of explaining different ways to handle configuration changes, including screen orientation changes. One of those methods, which is good for saving temporary state of the UI, is saving data in the onSavedInstanceState() method–as @Jason Kuang mentioned.

    Generally, you can rely on Android to save and restore the state of Views without any special effort on your part. The source code for the protected method onSaveInstanceState() explains (emphasis added):

    The default implementation takes care of most of the UI per-instance state for you by calling android.view.View.onSaveInstanceState() on each view in the hierarchy that has an id, and by saving the id of the currently focused view (all of which is restored by the default implementation of onRestoreInstanceState(android.os.Bundle)). If you override this method to save additional information not captured by each individual view, you will likely want to call through to the default implementation, otherwise be prepared to save all of the state of each view yourself.

    This is a little deceptive, because the API documentation states that EditTexts and TextViews must have android:freezesText="true" explicitly declared on them in your layout XML files to ensure that Android automatically stores their state when onSaveInstanceState() is invoked. I have not tested this recently, but it is what the source code seems to be doing. Therefore, handling temporary UI state on your own is best.

    Another tip: You can explicitly prevent the storage of temporary data for a View by calling setSaveEnabled(false) on that View. (This will not affect its children.)

    As a rule, it’s a good idea to manually save the on-screen state in your onPause() method, and also in onSaveInstanceState().

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

Sidebar

Related Questions

I am building an android application that reads text files. Now,i have multiple text
I have to admit that I'm new to Java and Android. db4o seems to
I have an Android Activity that needs to catch two different broadcasts. My current
Possible Duplicates: Make a wizard like application in Android Pattern one activity, multiple views.
I have built an android application which has a single mapview. I have a
I have one android activity which extends ListActivity. Every time list items is pressed
Hi I’m new to android and I’m developing a reminder that have three categories
I have two applications. One is declaring permission and having single Activity : Part
Ok, im fairly new to android but i have managed to teach myself the
i'm new at Android world, and i have a doubt, is there any method

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.