I have:
Toast.makeText(NewChatActivity.this, getString(R.string.invitation_sent_prompt, contact), Toast.LENGTH_SHORT).show();
(contact, is a String variable, as well as subForm ) and:
new AlertDialog.Builder(NewChatActivity.this).setTitle(getString(R.string.subscriptions))
.setMessage(getString(R.string.subscription_prompt, subFrom))
.setPositiveButton(R.string.approve_subscription, new DialogInterface.OnClickListener() {
....}
In both places, the getString
is launching an error:
Format String XXX is not a valid format string so it should be not passed to String.format
The resource looks like:
<string name="invitation_sent_prompt"> Invitation has been sent to <xliff:g id="user">%1$s</xliff:g>.</string>
.
The worst, is that the project was on Eclipse, and after the migration to AndroidStudio, is launching this error.
Where is the problem on getString?
The error explanation of code you posted says:
Your case is the first; now, in your chained call I don't see the
String.format
call. Try like this:In your case
subFrom
needs to be a string. Also, check that in ALL of your translation files the format string is "%1$s"