×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    188

    store array using setPreferenceForKey

    hi..

    i want to store array using setPreferenceForKey. is following correct?

    HTML Code:
    var arr = {
    	"number": 42,
    	"year"	: 2007,
    	"hello"	: "world",
    	"foo"	: "bar"
    }
    
    widget.setPreferenceForKey( arr,'searchKey');
    
    ----------------
    
    var my_cars= new Array();
    var my_cars = widget.preferenceForKey('searchKey');
    thanks

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: store array using setPreferenceForKey

    Hi kuddy_abc,

    you must always save string values, as specified in this Forum Nokia Library page:

    http://library.forum.nokia.com/index...1F28E9F27.html

    To save an array, you have to serialize it in some way (e.g.: using some separators between array values). When reading back the array, you have to perform the opposite operation, so parsing the string value to restore the original array.

    Hope it helps,
    Pit

Similar Threads

  1. how to store values of user in an array using stream
    By rohitnegi in forum Symbian User Interface
    Replies: 17
    Last Post: 2010-02-24, 06:50
  2. Store specified text in website to desc array
    By hrkrshn in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2009-12-07, 07:22
  3. widget.setPreferenceForKey
    By belenos@gmail.com in forum Symbian
    Replies: 4
    Last Post: 2009-10-19, 16:55
  4. setPreferenceForKey() size limit?
    By jappit in forum Symbian
    Replies: 4
    Last Post: 2008-12-05, 19:07
  5. widget.setPreferenceForKey doesn't work
    By alex@gorex.com.hk in forum Symbian
    Replies: 13
    Last Post: 2008-10-15, 07:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×