android – Handling focus change events

Question:

Can't figure out how focus works in android app. If at first view A, which is inside the PopupWindow , was under focus, and then the focus went to view B, which is on the activity itself, should the onFocusChange handler be onFocusChange with the parameter focused=false for view A?

Answer:

For the focus to work properly, you need to add 2 lines:

yourPopupWindow.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);
yourPopupWindow.setFocusable(true);
Scroll to Top