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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:17:39+00:00 2026-06-10T19:17:39+00:00

I have a complex data object in my Activity. A floating dialog like fragment

  • 0

I have a complex data object in my Activity. A floating dialog like fragment is shown when user wants to edit data for that object. This fragment has references to some parts of data object. User makes live edits to that data from this fragment. Some simple text editing, for example.

While user is editing this data, a configuration change happens.(the famous Orientation change). Upon change, every thing is automatically recreated by system including the floating fragment just like it was before.

I don’t know why, Android should have just restarted the Activty, why save and reload something that was manually created afterward ? But that’s another question.

So, while fragment’s new clone is back, it has lost that “Connection” to the data object. Because that data object’s gone too and we have a new one with all user edits lost. I want to save the state just before configuration change and regain it afterwards.

  1. How can an Activity determine if it is being launched by user
    (should start from scratch) or is being recreated by system on a config. change ( should reload
    saved state) ?

  2. And after that, how to re-establish the fragment’s connection to
    data object so the user can continue editing like nothing ever
    happened ?

  • 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-10T19:17:41+00:00Added an answer on June 10, 2026 at 7:17 pm

    For most of the question, I found some good ways:

    • The Arguments passed to fragment using setArguments() seem to be retained.
    • The call to Fragment method onAttach() is guaranteed. Data exchanges and event registering with parent goes here. The parent can be Activity or another Fragment so checking Fragment.getParentFragment() may be needed.
    • AsyncTaskLoader‘s are retained and automatically re-connected by system. Data fetching/processing code for fragment goes here.
    • Using custom data manager classes, fragments do not hold references to data objects , rather their numerical id’s, like in a database.
    • Instead of method calls from direct references , Command objects can be used.
    • Let Parent Activity broadcast events from one Fragment to all child Fragments, which can act as independent subscribers.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several complex data structures like Map< A, Set< B > > Set<
I have a web page that I use to update a fairly complex data
I have a complex Query (Without any locking hints) that takes data from many
I have a fairly complex ASP MVC set of controls that set a data
I have a web service that returns a complex data structure representing the results
For my app, I have a fairly complex set of configuration options that user
I have a process as follows: User does a complex search that is done
Strange issue- I have a complex DTO with several child objects, declared like this:
I have a class with a complex data member that I want to keep
I have a templated function fct that uses some complex data structure based on

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.