I need your help with this Inflater. From Activity3 I need to get what inside an EditText in Activity1.
Ex: in Activity1 i write my name, email, ecc. In Activity2 I choose my birthday and in the Activity3 i want to see both.
So i used in the Activity3 the LayoutInflater, but when i parse the EditText to string, the string is empty.
Here's the code:
LayoutInflater inflater = getLayoutInflater();
View v1 = inflater.inflate(R.layout.activity_register1, null);
etName = (EditText) v1.findViewById(R.id.etName);
etLastName = (EditText) v1.findViewById(R.id.etLastName);
etEmail = (EditText) v1.findViewById(R.id.etEmail);
etPassword = (EditText) v1.findViewById(R.id.etPassword);
actvCity = (AutoCompleteTextView) v1.findViewById(R.id.actvCity);
etDescription = (EditText) v1.findViewById(R.id.etDescription);
View v2 = inflater.inflate(R.layout.activity_register2, null);
datePicker = (DatePicker) v2.findViewById(R.id.datePicker);
birthday = new GregorianCalendar(datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth());
btnRegister = (Button) findViewById(R.id.btnRegister);
/** Register Button Click event */
btnRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String name = etName.getText().toString().trim();
String lastName = etLastName.getText().toString().trim();
String email = etEmail.getText().toString().trim();
String password = etPassword.getText().toString().trim();
String description = etDescription.getText().toString().trim();
String city = actvCity.getText().toString().trim();
String dateString = DateFormat.getDateInstance().format(birthday.getTime());
//if (!name.isEmpty() && !lastName.isEmpty() && !email.isEmpty() && !password.isEmpty() && !city.isEmpty())
Toast.makeText(getApplicationContext(), name, Toast.LENGTH_LONG).show();
//}
}
});
}
The dateString works. But with all the other strings are empty ("").
How can i fix this or tell me if there is another solution to this porblem.
Thanks.