String Arrays and Resources


Last Updated:

  1. Billiusmaximus

    Billiusmaximus Member This Topic's Starter

    Joined:
    Apr 28, 2010
    Messages:
    9
    Likes Received:
    0
    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

    Joined:
    Sep 14, 2009
    Messages:
    148
    Likes Received:
    26

Share This Page

Loading...