Android dynamic String Resources

前端 未结 4 1364
北恋
北恋 2020-12-09 23:03

in my app I do a web request that returns some result code, e.g. 105. I have string resources that look like that

O.K.         


        
4条回答
  •  渐次进展
    2020-12-09 23:43

    Try this getResources().getIdentifier(name, defType, defPackage) in a simple way.

    Toast.makeText(this, getResources().getIdentifier("r"+resultcode, "string", 
    getPackageName()), Toast.LENGTH_LONG).show();
    

提交回复
热议问题