boolean view.hasFocus() Returns true if this view has focus iteself, or is the ancestor of the view that has focus. if(editext.hasFocus()) { //to do }