Tuesday, January 28, 2014

How to shield Android Home button


            
I think on the inside of my Activity shielded Home button, watch my activity lunchMode is singleInstance. It is FullScreen. Requires shielding the Home key method does not affect the full-screen display (onAttatchToWindow not), and can be used in all android versions, not tight or a limited android4.0 platform. Please understand took stickers, help us put this out android who will encounter the problem completely resolved. Know how to say how much, we got closer, I'll summarize a.
Reply:
I would like to say that my problems encountered Ha, my Activity is full screen. Press the Home key to the future when there is a recent mission pop up, then come call, my program is SIP telephony program. But recently, the system is still in the above tasks, under my Activity is full screen. Into other programs, and then back to my program will be above the status bar (with getWindow (). SetType method set TYPE_KEYGROUND, in onAttatchOnWindow inside, if not set, then no problem). However, the program must be shielded Home. So I want to learn about other ways to shield Home, and this way I can shield the following version 2.2. Daniel seeking advice, vigorously scattered points
Reply:
Principle is to reload button in response to events
Reply:
The home key you can not do, windowmanagerservice of policy, phonewindowmanager before distribution key will first determine whether you want to distribute this event, in interceptKeyBeforeDispatching inside, he intercepted the home key.
Reply:
Ditto, home treatment is not distributed to the topmost View that went
Reply:
But it looks like I have seen in the post there buddy
position using the following method
Cite 17th floor nj_dobetter reply:

Make sure to add the following permissions in AndroidManifest.xml inside:



References ......

Thank you very much for your help, with your approach to indeed achieve a shield home button, but brings along a problem that the screen (my lock screen activity) can not respond to touch events, and I want the user by clicking on the screen block all keys except the off button on the outside of the button to unlock, so I based on your tips to your methods were slightly modified to achieve the full screen and can respond to the keyboard. Share my method:
================================================== ===============
Statement permissions:



Declare the function and activity class members:

Runnable mDisableHomeKeyRunnable = new Runnable () {

@ Override
public void run () {
disableHomeKey ();

}
};

Handler mHandler = new Handler ();

public void disableHomeKey ()
{
this.getWindow () setType (WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);.
}

In onCreate call:
mHandler.postDelayed (mDisableHomeKeyRunnable, 200);
================================================== ============


But I'm on my samsung System 2.3.4 in the interview for a moment, only to shield press, not shielded short press, who knows how it

Reply:
Well, do not tangle with the shield Home, it is best not to shield encountered asked feeds from the front solved. My solution of the BUG, ​​you only need to send a broadcast system to get rid of the DLG on OK
Reply:

No comments:

Post a Comment