String arrays are saving as int arrays


Last Updated:

  1. nickf77

    nickf77 Well-Known Member This Topic's Starter

    Joined:
    Jul 16, 2010
    Messages:
    47
    Likes Received:
    3
    It's probably something stupid that I'm overlooking, but nevertheless it's frustrating (and confusing) the crap outta me.

    I declared a string-array in my res/values/strings.xml file, but when I try to reference it in code, it says it's of type 'int' and can't be converted to a string. R.java also has it listed as an integer array. The thing is, in my XML it's declared as <string-array>, not <integer-array>. Any suggestions?
     

    Advertisement
  2. nickf77

    nickf77 Well-Known Member This Topic's Starter

    Joined:
    Jul 16, 2010
    Messages:
    47
    Likes Received:
    3
    Never mind - it WAS something stupid that I was overlooking....

    I was using
    Code (Text):
    1. R.array.<myArray>
    which returns an integer. Changed it to
    Code (Text):
    1. getResources().getStringArray(R.array.<myArray>)
    Problem solved. And now I feel like an idiot. :eek:
     

Share This Page

Loading...