setText(getString(R.strings.whatever) or setText(R.strings.whatever)?

后端 未结 3 543
傲寒
傲寒 2020-12-19 08:56

Both work, obviously if you start concatenating you\'ll need get string in order to avoid displaying an int.

Question: which is the most \'elegant\' or \'recommende

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-19 08:59

    You can add

    yourEditText.setText(getResources().getString(R.string.mytext));
    

    because you need get the resource context, after get the string.

提交回复
热议问题