2 Replies Latest reply on Feb 28, 2011 1:34 PM by psl7

    Best way to save data locally for mobile app?


      I'm making an application that involves flash cards and I'm still pretty new to Flex in general.  I would like to have the user input text in three TextAreas for a Title and side 1 and side 2 of a flash card.  Currently, I have everything down except how to save the card in its entirety for access later.  What would be the best way to do this?


      I've done some looking around and it seems like ArrayCollection might be the way to go, saving each card's specific aspects as an Object, but I'm still not sure.  Any input or advice would be wonderful.  Thanks!


      Also, in the Application I want to have all the user created cards displayed in a List that is created in a different View.  The idea is, that they will be able to click the 'Title' of the card and then be taken to the actual card in the Application.

        • 1. Re: Best way to save data locally for mobile app?

          When you say access for later, do you mean between application launches or at runtime?  If you want to persist sometihng between launches, you can use the persistenceManager object on the application.  This object allows you to save and retrieve key-value pairs.  If you want to do this at runtime, I would suggest just having some sort of service or object (such as an ArrayCollection) in the global scope so that you can easily retrieve the information as necessary.


          When pushing on a new view, you can pass data to the new view using the pushView api.  This allows you to send some identifier or data object for a specific card to the next view so that i can properly display it.  For example:


          navigator.pushView(CardView, cardData);


          The new CardView will have the cardData object you sent set to its data property.  See http://opensource.adobe.com/wiki/display/flexsdk/View+and+ViewNavigator for more information.



          1 person found this helpful
          • 2. Re: Best way to save data locally for mobile app?
            psl7 Level 1

            Thanks.  I figured it out a couple days ago.