Question:
I prescribe this value:

holder.txt_version.setText("version : " + item.getVersion_name()); 

The app displays approx.

vesion: 7.2.0

But, after trying to infer from @string /

 holder.txt_version.setText("@string/txt_version" + item.getVersion_name()); 

The app displays approx.

"@ string / txt_version": 7.2.0

Tell me what the error is, if it is written in string.xml

 <string name="txt_version">version :</string> 
  • four
    maybe because quotation marks ("") indicate a string for output, and resources are taken like this - tvt_version.setText (R.string.txt_version) - Nikotin N
  • Perhaps reading the official documentation will help you solve your own question - pavlofff

1 answer 1

 @string/txt_version таким образом можно задать строку только в xml. 

Programmatically set via R class

 textView.setText(R.string.txt_version)