How to judge Main Get focus?

I need to judge Mian Get focus to a window[view: “window”] closed。I want to achieve the effect of the menubutton pop-like android comes。

The question is not clear enough. Could you explain it in detail ?