Skip to content

Instantly share code, notes, and snippets.

@takuya-i
Created July 18, 2012 14:46
Show Gist options
  • Save takuya-i/3136619 to your computer and use it in GitHub Desktop.
Save takuya-i/3136619 to your computer and use it in GitHub Desktop.
[android] force set forcus to View object
/**
* android snippet
* Force set forcus to View object.Somtimes this is not effected
*
* @param v View instance object of set forcus
*/
public void foceSetFocus(View v) {
v.setFocusable(true);
v.setFocusableInTouchMode(true);
if (!v.requestFocus()) {
v.requestFocusFromTouch();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment