I'm having some issues with using Butterknife
and getting text from EditTexts
. I have an activity with many EditTexts
. For brevity sake, I'll only include 2-3 in my code example(s). I'm eventually taking the entered text and using it with iText's library to spit out a PDF.
First, I'm binding views with Butterknife:
public class NewPatientActivity extends AppCompatActivity {
@BindView(R.id.new_patient_editText_last_name)
TextInputEditText lastNameTextInputEditText;
@BindView(R.id.new_patient_editText_nick_name)
TextInputEditText nickNameTextInputEditText;
@BindView(R.id.new_patient_editText_date_of_birth)
TextInputEditText dateOfBirthTextInputEditText;
Then I ButterKnife.bind(this);
in onCreate()
.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_patient);
ButterKnife.bind(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
Then, clicking on my floating action button is supposed to grab the text that was entered text in the EditTexts
:
@OnClick(R.id.floating_action_button)
public void finishedPatientNotesFabClick(View view) {
try {
String lastNameText = lastNameTextInputEditText.getText().toString();
String nickNameText = nickNameTextInputEditText.getText().toString();
String dateOfBirth = dateOfBirthTextInputEditText.getText().toString();
}
Then I try using those strings when I use them as the parameter for constructing a new Paragraph:
private static void addBioAndContactInfoChapter(Document document) throws DocumentException {
bioAndContactInfoChapter.add(new Paragraph(R.string.patient_last_name) + ": " +
lastNameText);
bioAndContactInfoChapter.add(new Paragraph(R.string.patient_nickname) + ": " +
nickNameText);
bioAndContactInfoChapter.add(new Paragraph(R.string.patient_date_of_birth) + ": " +
dateOfBirth);
But here's where the problem is. When I use those strings, I get the
cannot resolve symbol '__string name'.
The Paragraph class has a constructor which only takes a String, so I don't think that's the issue. Is something funky happening because of Butterknife or what? Any help would be greatly appreciated!!!