view raw
Kapila Ranasinghe Kapila Ranasinghe - 10 months ago 104
Java Question

Android Home Button Disable error

I'm developing some android application .In application i want to disable home button .

So i tried to overide

method, but the problem is i getting a error when start application.

Code :

public void onAttachedToWindow(){

Error :

java.lang.IllegalArgumentException: Window type can not be changed after the window is added.
at android.os.Parcel.readException(
at android.os.Parcel.readException(
at android.view.IWindowSession$Stub$Proxy.relayout(
at android.view.ViewRootImpl.relayoutWindow(
at android.view.ViewRootImpl.performTraversals(
at android.view.ViewRootImpl.doTraversal(
at android.view.ViewRootImpl$
at android.view.Choreographer$
at android.view.Choreographer.doCallbacks(
at android.view.Choreographer.doFrame(
at android.view.Choreographer$
at android.os.Handler.handleCallback(
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invoke(Native Method)

any one have idea , what is the error of this code ?


As I mentioned in other question, you are not able to disable or override, or even detect home button. Set type of window you can only before setContentView().