String Arrays and Resources

Discussion in 'Application Development' started by Billiusmaximus, May 17, 2010.

  1. Billiusmaximus

    5

    Apr 28, 2010
    9
    0
    5
    California
    Hi Everyone,

    I am using a string array I placed in the /res/strings.xml file and I want to use the elements in the array to display to screen. So I tried this:

    int index = 1;
    TextView t = (TextView) findViewById(R.id.lblSetup);
    t.setText("Setup Preference: " + R.array.myArray[index]);

    But the syntax in line 3 is not valid. How can I index into my array to display that element onscreen?

    Thanks,
    Billius
     

    Advertisement

  2. markb

    markb Well-Known Member
    53

    Sep 14, 2009
    148
    26
    53
    Software Developer (Java, C, Web, Unix)
    Birmingham, UK

Share This Page

Loading...