EditText editText = findViewById(R.id.editText); editText.setInputType(InputType.TYPE_CLASS_NUMBER);
EditText editText = findViewById(R.id.editText); editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
EditText editText = findViewById(R.id.editText); editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);In this example, the EditText widget is configured to accept valid email addresses. The android.widget package is part of the Android Framework, and it provides various widgets used in building UI components of an Android application.