How to put variable inside string-resources?

后端 未结 4 411
情歌与酒
情歌与酒 2020-12-08 18:07

Is it possible to put variables inside string-resources? And if yes - how do i use them.

What i need is the following:

4条回答
  •  半阙折子戏
    2020-12-08 18:45

    You shot %1$d pounds of meat!  
    
    
    int numPoundsMeat = 123;
    String strMeatFormat = getResources().getString(R.string.meatShootingMessage, numPoundsMeat);
    

    Example taken from here

提交回复
热议问题