Android Question State Manager - Statemgr

Discussion in 'Android Questions' started by Rusty, Jul 5, 2015.

  1. Rusty

    Rusty Well-Known Member Licensed User

    I've been using the State manager (as a library) to save the state/variable/etc. for years.
    Now, all of a sudden, some of the variables (type structures) that have always been successfully restored are failing to be restored.
    After installing version 5.02, I've noticed this. (not sure if this is the reason)
    I re-compiled the library with 5.02, thinking this might solve this issue, but to no avail.
    Does anyone have any experience like this and if so, how was it solved?
  2. Erel

    Erel Administrator Staff Member Licensed User

    Can you reproduce it in a small project?
  3. Rusty

    Rusty Well-Known Member Licensed User

    Hi Erel,
    I've tried to create a small program that reproduces the problem, but it works perfectly...
    In my large application, it fails sporadically, using exactly the same steps with exactly the same data, it will work, then doing it again, it will not work.
    I've narrowed it down to when my application goes through Activity_Pause (with Statemanager) and runs another activity; upon return it goes through Activity_Resume (with Statemanager)

    In my small program, I traced the StateManager and it doesn't appear to store and retrieve anything except VIEWS, is this correct?

    The problem array that is not being restored (or kept in-tact) reliably is a large type structure of many arrays, populated with data.

    I declare the type structure in Process_Globals.
    (To test, I declared the array with a dimension of 2 and then later re-dimensioned it to i.e. 17 or 40 or whatever depending upon live data)

    When I start another activity from MAIN, the array is OK (has many elements); when I get into the NEW activity, the array is OK; upon NEW activity finish, the array is OK; upon MAIN activity_resume, the array is back to the original (empty) dimensions.

    Your help is greatly appreciated.

    I might add that this program has been running for about 4 or 5 years with the existing statemanager code and it has never failed before.
  4. Erel

    Erel Administrator Staff Member Licensed User

    Yes. It only stores the views state.

    For StateManager to work properly the order of views must always be exactly the same.
    Peter Simpson likes this.
  5. Rusty

    Rusty Well-Known Member Licensed User

    Thanks Erel,
    Have you ever seen an issue where a large type structure array gets "corrupted" or re-set upon activity_resume from another activity (that does not even refer to the array in question)?
  6. Erel

    Erel Administrator Staff Member Licensed User

    No. Make sure to use a different activity name for each activity.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice