I suggest you start by looking at View.java
class which basically has the basic building block for user interface component.
../frameworks/base/core/java/android/view/View.java
and lookup the method onFocusChanged
if you are only interested in EditText
add the following line
if (this instanceof EditText) {
Toast.makeText(getContext(), "focus gained!", Toast.LENGTH_SHORT).show();
}
build again and you will see toast notification everytime you gain focus to any EditText
around the OS