[Solved] How to set class property default value from R.string.xxx


You can add parameter Context in your new newInstance() method.
For example:

public static TestFragment newInstance(Context context) {
    if (fragment = null) {
        fragment = new TestFragment();
        text = context.getResources().getString(R.string.voice_search_label);
    }
    return fragment;
}

solved How to set class property default value from R.string.xxx