I have 5 EditTexts on my app. What I'm curious about is whether Android provides a method to know if the content of EditText is empty. Or do I have to code it separately?
android-edittext android
EditText usernameEditText = (EditText) findViewById(R.id.editUsername);
sUsername = usernameEditText.getText().toString();
if (sUsername.matches("")) {
Toast.makeText(this, "You did not enter a username", Toast.LENGTH_SHORT).show();
return;
}
Yes, I think you can do it like this.
© 2024 OneMinuteCode. All rights reserved.