Use the attached code to give the focus to "someone else", this is OK if you have a view where you simply want to dismiss the keyboard and release the focus, you don't really care about who gets it.
Use like this: FocusHelper.releaseFocus(viewToReleaseFocusFrom)
public class FocusHelper {
public static void releaseFocus(View view) {
ViewParent parent = view.getParent();
ViewGroup group = null;
View child = null;
while (parent != null) {
if (parent instanceof ViewGroup) {
group = (ViewGroup) parent;
for (int i = 0; i < group.getChildCount(); i++) {
child = group.getChildAt(i);
if(child != view && child.isFocusable())
child.requestFocus();
}
}
parent = parent.getParent();
}
}
}
Doc: The method traverses from the child view and up the view tree and looks for the first child to give focus to.
Edit: You can also use the API for this:
View focusableView = v.focusSearch(View.FOCUS_DOWN);
if(focusableView != null) focusableView.requestFocus();