Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal Exception: java.util.UnknownFormatConversionException Conversion: מ

This code gives error on String.format(...):

inviterNameTitleView.setText(
                String.format(
                        context.getString(R.string.sharing_invite_title),
                        inviter.getNameForTitle()
                )
        );

R.string.sharing_invite_title is <string name="sharing_invite_title">%s invites you to smth.</string>

What could be the reason of this error? The symbol that results in error is a right-to-left alphabet letter. Googling doesn't give any answers.

like image 637
soshial Avatar asked Apr 02 '26 21:04

soshial


1 Answers

It turned out that the app crashed only when on Hebrew locale, which was with iw code (not on he), which was weird to have the old code on Android 5.0. The corresponding string in strings file had s% instead of %s. That gave the UnknownFormatConversionException.

This happens because of lack of RTL support in Android Studio. See more detailed answer in this question: Android strings.xml resource - arabic language and dynamic formatted strings

like image 175
soshial Avatar answered Apr 04 '26 09:04

soshial



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!