I need to find out if any view is focused inside an Activity and what view it is. How to do this?
The View. isFocused() method tells whether the view in question is focused or not. Or else, you can compare your views by id. @CGR Well, isFocused() is the preferred way to go here.
You can use View. OnFocusChangeListener to detect if any view (edittext) gained or lost focus. This goes in your activity or fragment or wherever you have the EditTexts.
Call getCurrentFocus()
on the Activity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With