0

I am making a lock screen app for android and so it requires that both the notification bar and home button be disabled. Since ICS and further versions do not allow disabling of the Home button, is there a way to do it in the previous versions?

kabuto178
  • 3,129
  • 3
  • 40
  • 61
vipin
  • 41
  • 9

2 Answers2

0

You can add this snippet to your Activity:

@override

public void onAttachedToWindow()
{  
       this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);     
       super.onAttachedToWindow();  
}

But will not work in ICS and jelly bean and will give you crash in app.For more details see these references:

Android - Is It possible to disable the click of home button

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

Community
  • 1
  • 1
hasanghaforian
  • 13,858
  • 11
  • 76
  • 167
0

Check last answer here... its a workaround but it makes sense

Not able disable Home button on specific android devices

Community
  • 1
  • 1
RonEskinder
  • 527
  • 8
  • 24