android studio input field code example

Example 1: android text field numpad

android:inputType="number"

Example 2: android java text fields

EditText usernameEditText = (EditText) findViewById(R.id.Plain textid);

Example 3: java android edit text set value

EditText bookInput = (EditText)findViewById(R.id.book);
bookInput.setText("The Shining");

Example 4: how to make a text field required in android studio

if(TextUtils.isEmpty(eventEdit.getText()))
{
  eventEdit.setError(" Please Enter Event Name ");
}else {
  //proceed with operation
}

Tags:

Misc Example