1. Download our Official Android App: Forums for Android!

Apps String Arrays and Resources

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

  1. Billiusmaximus

    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    9
    Joined:
    Apr 28, 2010

    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
    Rank:
    None
    Points:
    63
    Posts:
    148
    Joined:
    Sep 14, 2009

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

Share This Page

Loading...