The following method gets called when window's focus changes. For instance, if the window gains/losses focus, it will be triggered. In case, the window gains focus, hasFocus
is true and false otherwise.
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if(hasFocus)
Toast.makeText(context, text, duration).show();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…