Android Question How to get the map in the map ?

Discussion in 'Android Questions' started by fash866, Apr 19, 2015.

  1. fash866

    fash866 Member Licensed User

    please see my code:
    Code:
    Dim test As Map
        test.Initialize
        test.Put(
    "a","abc")
        test.Put(
    "b","234")
       
        
    Dim test2 As Map
        test2.Initialize
        test2.put(
    "a1","111")
        test2.put(
    "a2","222")
       
        test.Put(
    "c",test2)
       
        
    File.WriteMap(File.DirInternal,"tttt",test)
       
        
    Dim ok As Map
        ok.Initialize
        ok=
    File.ReadMap(File.DirInternal,"tttt")

        
    Dim ok2 As Map
        ok2 = ok.Get(
    "c"' Here is the wrong code, How to get the "test2"
     
  2. DonManfred

    DonManfred Expert Licensed User

    Did you get any error message? WHAT ERROR MESSAGE?????

    To save a map in a map you need to write and read a OBJECT
    Writemap does only work on primitives int, long, real, string

    Use Keyvaluestore and write (and reread) the map with
    Code:
    ' write the map
    kvs.PutObject("map",m)

    ' read the map
    dim m as map =  kvs.GetObject("map")
     
    Last edited: Apr 19, 2015
  3. NJDude

    NJDude Expert Licensed User

    You are not initializing the "ok2" map.
     
    lemonisdead likes this.
  4. fash866

    fash866 Member Licensed User

    [​IMG]
     

    Attached Files:

  5. Erel

    Erel Administrator Staff Member Licensed User

    File.ReadMap returns a map with strings (as File.WriteMap creates a text file).

    You should use KeyValueStore class instead.
     
    fash866 likes this.
  6. Troberg

    Troberg Well-Known Member Licensed User

    No need to initialize it if you are assigning an initialized map to it.

    Simplified example, this is perfectly valid:
    Code:
    Dim map1 as Map
    map1.Initialize

    Dim map2 as Map
    map2=map1
     
  7. fash866

    fash866 Member Licensed User

    Yes ! I need it!
     
Loading...
  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