1. Check out our companion app, Forums for Android! Download from Google Play

String arrays are saving as int arrays

Discussion in 'Application Development' started by nickf77, Jul 16, 2010.

  1. nickf77

    nickf77 Well-Known Member
    Thread Starter
    36

    Jul 16, 2010
    47
    3
    36
    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
    Thread Starter
    36

    Jul 16, 2010
    47
    3
    36
    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...