You get a ResourcesNotFoundException
because you're adding int
values (resource identifiers are mapped to int
values at compile time) instead of concatenating String
s.
The sum of the various resource identifiers might even be another valid resource identifier, but that would only happen accidentally. Nevertheless, if you pass an int
value into setText()
, the runtime tries to find a string resource by that number. In your case, it failed and so your app crashed.
So you have to get the String
s first and concatenate them afterwards:
points_txt.setText(getString(R.string.you_have) + current_points + getString(R.string.points));