0

当我单击设备中的主页按钮时想要打开设备的设置我尝试了此代码但是当应用程序启动时它会自动打开设备设置

        @Override
    public void onAttachedToWindow() {
       super.onAttachedToWindow();
       this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); 
       startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);
    }

仅当单击主页键按钮时,如何使此代码打开设备的设置?

4

0 回答 0