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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:12:33+00:00 2026-05-26T00:12:33+00:00

Possible Duplicate: Android: Saving a state during Android lifecycle i want to save some

  • 0

Possible Duplicate:
Android: Saving a state during Android lifecycle

i want to save some values in a file before the user terminates the activity.In which method should i implement this?

Apart from using a file , or sql lite is there a way of storing complex data such as a layout (that has dynamically changed ) ?

“onDestroy() Note: do not count on this method being called as a place for saving data!”

  • 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-26T00:12:34+00:00Added an answer on May 26, 2026 at 12:12 am

    Layouts are bound to the context of the Activity that holds it, so you do no want to save full View objects to files because the Activity that it’s attached to is void.

    The easiest method (depending on the amount and type of data you want to save) is using the SharedPreferences library. It’s a file I/O wrapper that makes saving and retrieving data pretty simple. You can save the specific layout data in the onPause() method, the rebuild the layout with the specifications in onResume().

    If the data you need is too complex for SharedPreferences, you’ll have to save it to use other methods for saving (found in that link). The process for rebuilding the layouts will be the same.

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

Sidebar

Related Questions

Possible Duplicate: Android: ProgressDialog.show() crashes with getApplicationContext I want to have a progress dialog
Possible Duplicate: Android Emulator - Trouble creating user accounts I'm trying to register a
Possible Duplicate: Can we delete an SMS in Android before it reaches the inbox?
Possible Duplicate: Android Webview - Webpage should fit the device screen I want to
Possible Duplicate: How to restrict Android device to not open some specific site e.g.youtube,
Possible Duplicate: MVC pattern in Android? I want to follow MVC architecture in Android
Possible Duplicate: Bluetooth support on Android Emulator I want to develop an Android Application
Possible Duplicate: Android - Application (apk) Maximum size I want to install an APK
Possible Duplicate: Lock the Android device programmatically I want to lock the screen through
Possible Duplicate: Android Spinner OnItemSelected Called Erroneously (without user action on opening spinner) Does

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.