Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java files: Suppressing hardcoded text warnings

Because of some 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 warnings?

like image 561
Zoe stands with Ukraine Avatar asked Feb 07 '23 06:02

Zoe stands with Ukraine


1 Answers

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.

like image 166
laalto Avatar answered Feb 11 '23 15:02

laalto