Application ButterKnife.bind(this);
There is an activit, in it declared values approximately as follows:
@BindView(R.id.name) TextView name; @BindView(R.id.gender) TextView gender; In the onCreate method added:
ButterKnife.bind(this); And below in my method I try to write as follows:
private void someMethod() { name.setText(stringFormater.formatString(model.getTitle(), R.string.name)); gender.setText(stringFormater.formatString(model.getGender().toString(), R.string.score)); } But it turns out to start only as follows:
private void someMethod() { name = (TextView) findViewById(R.id.name); name.setText(stringFormater.formatString(model.getTitle(), R.string.name)); gender= (TextView) findViewById(R.id.gender); gender.setText(stringFormater.formatString(model.getGender().toString(), R.string.score)); } But so the whole point is lost application
Full activation code:
public class TopActivity extends AppCompatActivity { private Model model; @BindView(R.id.name) TextView name; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_top_story); model = getIntent().getParcelableExtra("key"); populateTextViews(); ButterKnife.bind(this); } private void populateTextViews() { StringFormater stringFormater = new StringFormater(this); name.setText(stringFormater.formatString(model.getTitle(), R.string.name)); } }