Is it possible to do string substitution in Android resource XML files directly?

前端 未结 4 2071
误落风尘
误落风尘 2021-01-04 20:03

In my android app, I have a large string resource xml file. I want to make reference and reuse declared resources values within String values. Is it possible to have the R

4条回答
  •  无人及你
    2021-01-04 20:58

    Add a %s to your second resource string (the one that you want to be dynamic) where you want it to be modified. i.e.,

    
    tbl_name
    create table %s
    
    

    and in your code use getString() to work the magic,

    getString(R.string.ddl, getString(R.string.db_table_name));
    

提交回复
热议问题