以编程方式在 TextView 中设置文本的正确方法

2 java string android

这是以编程方式设置文本的正确方法吗TextView

points_txt.setText(R.string.you_have + current_points + R.string.points);`
Run Code Online (Sandbox Code Playgroud)

它向我显示了该字符串的 ResourcesNotFoundException 错误,而我可以在 strings.xml 文件中看到该字符串。

Raj*_*Raj 6

points_txt.setText(getResources().getString(R.string.you_have) + current_points + getResources().getString(R.string.points));
Run Code Online (Sandbox Code Playgroud)