Button myButton = findViewById(R.id.my_button); myButton.setFocusable(true);
TextView myTextView = findViewById(R.id.my_text_view); myTextView.setFocusable(false);In this example, we set a TextView view as not focusable, meaning the user cannot select it using input devices. Package Library: The setFocusable method is part of the android.view.View class, which is included in the standard Android library.