开发者

How does Android handle multiple substitution in translation text?

I need to enter text like开发者_开发知识库 the following

So far {0, integer} items added out of {1, integer} items.

It does not do the substitution. Here is my code which should do the substitution.

MyActivity.this.getString(R.string.msgSoFarOutOf, new Object[]{Integer.valueOf(itemsAdded), Integer.valueOf(itemssTotal)})


You need to use %d, %s, etc., same as for String.format(). BTW, getString() is a varargs method, so you don't need an array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜