Disabling Android home button for industry application

后端 未结 2 851
失恋的感觉
失恋的感觉 2021-02-09 11:44

I\'m writing an industry application which will be used by traffic wardens to register offences through my program using forms.

The app is using a webview so it is just

2条回答
  •  半阙折子戏
    2021-02-09 12:22

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    
        getWindow().addFlags(  WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    

    }

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

提交回复
热议问题