OnCreate method is used to initialize view and flatten the layout , so I am thinking that if onCreate method is running before everything means my EditText field is empty means null so how this condition is working. But it working fine it means I am understanding something incorrectly. Please tell me what I am missing.
code snippet is taken from google codelabs where we are providing phone no. in editText and by clicking send button in device inbuilt keyboard we launch phone application to dial given number.
EditText editText = findViewById(R.id.editText_main);
if (editText != null) {
editText.setOnEditorActionListener
(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
return false;
}
});
}
