0

Is it possible to set text of textview in xml from string array? (like android:text="@string/title[3]" if I want to set the third item) Or I have to do it programatically?

Thanks in advance.

1
  • 1
    It is not possible. textview.setText(title[3]) Commented Feb 27, 2015 at 17:49

1 Answer 1

1

Unfortunately you cannot access in layout xml file.

But you can do it in java

    String[] some_array = getResources().getStringArray(R.array.your_string_array);
textView.setText(some_array[5]);
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.