Polarbear0106 Polarbear0106 - 3 months ago 20
Java Question

Java files: Suppressing hardcoded text warnings?

Due to having to add separators in TextView's(e.g.

...+ "," +...
) I get Hardcoded text warnings. ("Do not concenate text...")

I tried using both SupressLint and SupressWarnings:

@SuppressWarnings("HardcodedText")
@SuppressLint("HardcodedText")


But it does not work. How can I block these annoying warnings?

Answer

The name of the lint check you want to suppress is SetTextI18n, not HardcodedText.

You can also use

//noinspection AndroidLintSetTextI18n

to target the suppression to the following code line only and not the whole method or class.

Comments