Reviving an old [degenerate] thread, rather than creating a new one... I've been getting occasional UnknownFormatConversionException error reports in my Dev Console, and had no idea what they were from. Today I think I've figured it out, because it's occurring reliably on my Honeycomb device.
Turns out it happens when there's a "%" character in a string resource used as a label in a PreferencesActivity. Seems that the system thinks it's going to be a format specifier, tries to evaluate it as such, fails, and then falls over. But in my case, it's not; I'm letting the user specify a pref for transparency of an AppWidget, with options like 25%, 50%, etc. I'm not sure how to fix it yet, and I'm open to suggestions. I tried "/ %", like you do for an apostrophe char, but that didn't work at all. Tried "%" (the entity for "%"), but apparently that gets evaluated too early, and the same problem occurs. If all else fails, I could just use "percent", but that's kind of hokey. Any other ideas? String On Apr 5, 8:38 am, mastermind <[email protected]> wrote: > Some error occured on device with Cyanogen: > 04-03 14:35:04.793 E/AndroidRuntime(21105): > java.util.UnknownFormatConversionException: Conversion is '' > 04-03 14:35:04.793 E/AndroidRuntime(21105): at java.util.Formatter > $FormatSpecifierParser.advance(Formatter.java:2641) > 04-03 14:35:04.793 E/AndroidRuntime(21105): at java.util.Formatter > $FormatSpecifierParser.parseConversionType(Formatter.java:2716) > 04-03 14:35:04.793 E/AndroidRuntime(21105): at java.util.Formatter > $FormatSpecifierParser.parseArgumentIndexAndFlags(Formatter.java:2687) > 04-03 14:35:04.793 E/AndroidRuntime(21105): at java.util.Formatter > $FormatSpecifierParser.parseFormatToken(Formatter.java:2624) > 04-03 14:35:04.793 E/AndroidRuntime(21105): at > java.util.Formatter.doFormat(Formatter.java:1072) > 04-03 14:35:04.793 E/AndroidRuntime(21105): at > java.util.Formatter.format(Formatter.java:994) > 04-03 14:35:04.793 E/AndroidRuntime(21105): at > java.lang.String.format(String.java:2254) > 04-03 14:35:04.793 E/AndroidRuntime(21105): at > java.lang.String.format(String.java:2219) > 04-03 14:35:04.793 E/AndroidRuntime(21105): at > android.preference.ListPreference.getSummary(ListPreference.java) > It happens only on Cyanogen's firmware when there's "%" symbol in > ListPreference's summary. > > If u will open ListPreference.java from Froyo's sources u wouldn't > find method ListPreference.getSummary, so it looks like ListPreference > uses base method from Preference.java: > public CharSequence getSummary() { > return mSummary; > } > And javadoc's from eclipse it confirms that:Returns the summary of > this Preference. > > Ok, now let's open ListPreference.java from Cyanogen's sources: > public CharSequence getSummary() { > final CharSequence entry = getEntry(); > if (mSummary == null || entry == null) { > return super.getSummary(); > } else { > return String.format(mSummary, entry); > } > } > It look's like it's Cyanogen's feature (only 8 bug reports from >3000 > users), but let's go > tohttp://developer.android.com/reference/android/preference/ListPrefere... > Returns the summary of this ListPreference. If the summary has a > String formatting marker in it (i.e. "%s" or "%1$s"), then the current > entry value will be substituted in its place. > > WHAT IS GOING ON HERE??? > Can someone explain how *exactly* getSummary works? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

