How to easily iterate over all strings within the “strings.xml” resource file?

后端 未结 4 1520
刺人心
刺人心 2021-01-22 08:36

I created an application that uses the TTS engine to send feedback to the user. With the aim to improve the performance, I used the synthesizeToFile and addSp

4条回答
  •  借酒劲吻你
    2021-01-22 08:39

    You can give them all (while defining) the resource name as "prefix"+(1..n). And in the code use,

    int resid=;
    for(i=1;resid!=0;i++){
            resid = this.getResources().getIdentifier("prefix"+i, "strings", this.getPackageName());
    }
    

提交回复
热议问题