I am loosing my mind on this one. I am getting error saying "Variable 'joiningDate' might not have been initialized". Here is the code:
private TextView joiningDate;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_registration);
joiningDate = findViewById(R.id.joiningDate);
}
private void saveData() {
String name = editTextName.getText().toString();
String email = editTextEmail.getText().toString();
String phone = editTextPhone.getText().toString();
String userId = editTextUserId.getText().toString();
String password = editTextPassword.getText().toString();
String joiningDate = joiningDate.getText().toString();
// Now send this data to your server
sendDataToServer(name, email, phone, userId, password, joiningDate);
}
Please help me fix it.
You are using same name for the string as the textview. Use a different name instead of joiningDate
String joinDate = joiningDate.getText().toString();