Hi,everyone:
Listing 15.8 new getCrimeReport () method(CrimeFragmment.java)
I follow the code in the book, but enter suspect=getString (R.string.crime_report_suspect, suspect). When the Android Studio prompts the following error, has anyone had this problem?
Format string ‘crime_report_subject’ is not a valid format string so it should not be passed to String.format less… (Ctrl+F1)
If a string contains a ‘%’ character, then the string may be a formatting string which will be passed to String.format from Java code to replace each ‘%’ occurrence with specific values. This lint warning checks for two related problems: (1) Formatting strings that are invalid, meaning that String.format will throw exceptions at runtime when attempting to use the format string. (2) Strings containing ‘%’ that are not formatting strings getting passed to a String.format call. In this case the ‘%’ will need to be escaped as ‘%%’. NOTE: Not all Strings which look like formatting strings are intended for use by String.format; for example, they may contain date formats intended for android.text.format.Time#format(). Lint cannot always figure out that a String is a date format, so you may get false warnings in those scenarios. See the suppress help topic for information on how to suppress errors in that case.