The following code shows how to Add focus change listener to EditText.
//create an anonymous inner class to act as an onfocus listener EditText txt1 = (EditText)findViewById(R.id.txt1); txt1.setOnFocusChangeListener(new View.OnFocusChangeListener() {/* ww w . j av a 2 s.c o m*/ @Override public void onFocusChange(View v, boolean hasFocus) { Toast.makeText (getBaseContext(), ((EditText) v).getId() + " has focus - " + hasFocus, Toast.LENGTH_LONG).show(); } );