EditText editText = findViewById(R.id.editText); editText.requestFocus();
Button button = findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { EditText editText = findViewById(R.id.editText); editText.requestFocus(); } });This code sets up an OnClickListener for a button with the ID "button". When the user taps the button, it retrieves the EditText object with the ID "editText" and requests focus for it. These examples use the android.widget package, which is part of the core Android SDK.