0

I have a string array defined in xml:

<string-array name="question_array">                        
    <item> q1 "First string"</item>  
    <item> q2 "Second string "</item>  
</string-array>  

and want to use SetText to access and display these strings. None of these variations work:

setText(R.array.question_array[counter]);
setText(R.string.question_array[counter]);
setText(R.array.question_array);
setText(R.string.question_array);

What is the proper syntax for doing this?

1 Answer 1

2
            Resources r = getResources();
    Duration = r.getStringArray(R.array.planets_array);//duration is array i created in my code 

create your own array and use it in your code

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.