2
어댑터의 문자열 리소스에 액세스합니다. 그러나 나는 어느 방법으로 유용하고 더 나은 성과를 낼지 염려합니다. 첫 번째 방법은 유용하지 않지만 성능면에서 문제가 발생합니까?어댑터 보유자의 Android getString 성능 문제
1;
Context context;
public Adapter(Context context){
this.context = context;
}
...
...
public void onBind(Holder holder,int position) {
holder.text.setText(context.getResources().getString(R.string.formText, position));
}
2;
Context context;
String formText;
public Adapter(Context context){
this.context = context;
this.formText= context.getResources().getString(R.string.formText);
}
...
...
public void onBind(Holder holder,int position) {
holder.text.setText(String.format(formText, position));
}