What does this 4 line java code means in android application?

喜你入骨 提交于 2019-11-27 15:18:27
@Override
public void onAttachedToWindow()
  {
  this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
  super.onAttachedToWindow();
  }

is used to disable home button in android but

this security flaw has been fixed in newer versions of Android so it will not work in ICS and jelly bean...!!

I've solved this issue putting

this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);

in onCreate before calling super.

 protected void onCreate(Bundle savedInstanceState) {

        this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);

        super.onCreate(savedInstanceState);
}

Saludos desde Medellín

@Override    
public void onWindowFocusChanged(boolean hasFocus) {
    this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);    
    super.onWindowFocusChanged(hasFocus);
}

I had some problems with windowAttached as well, try using windowFocusChanged instead.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!