I am having trouble with setting text in a text view with format and multiple values.
holder.car.setText(R.string.mycar + lm.getCarName() + R.string.year + lm.getYear());
this is giving me " 2143545 Camero 2143213 1977 "
I have tried few other "solutions" from the web
holder.car.setText(getString(R.string.mycar) + lm.getCarName() + getString(R.string.year) + lm.getYear()); << not work, getString undefine>>
I even tried String.valueOf(R.string.mycar); getResources().getText(R.String.mycar)
, still it didn't work.
It would be great if someone can help me, thanks
R.string.mycar
is anint
that refers to a resource. It's not the actual resource. @user1417127 's answer looks good. It fetches the actual string resource for you – Extraterritorial