I have android app and this string in resources:
Select up to %1$d people!
Thi
Try File -> Invalidate Caches / Restart...
, it fixed the problem for me.
In my case invalidating cache with restart did not help, but having consistent formatting parameters (e.g. %s
) across other the locales resolved the issue. I hope this might be helpful to someone in the future.
For the formatting of the string to be correct:
String.format(Locale.ENGLISH, itemView.context.getString(R.string.XXX), "%17")
Also the special characters do not have to interfere with the injection of parameters. For that, take into account the exhaust outlets for special characters
From: <string name="XXX">% %1$s</string>
To: <string name="XXX">%1$s</string>
Finally XXX is "%17"
Good Luck.
Source
You're probably missing the format method of the String class, If you're setting it in a TextView, the proper way is:
textView.setText(String.format(getResources().getString(R.string.create_group_select_people), countMax));
Try doing a 'clean project' followed by a close and reopen of Android Studio.
That fixed it for me, it looks like some minor Android Studio /Lint bug.
I just copied the code and it works well. so you may need to check some other place,Here are my suggestions.