1

アプリケーションでシステム バーを表示および非表示にする必要があるため、そのために 2 つのボタンを使用しました。以前は、Android (3.0.1) と Android (4.1.1) の両方のデバイスをテストしていました。Android (3.0.1) の場合、要件に応じてシステム バーを非表示および表示できます。しかし、Android (4.1.1) では、システム バーの表示と非表示を切り替えるボタンが機能しません。

そして私のコードは

// Showing system bar
    showSystemBarBtn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            try {
                Process proc = Runtime.getRuntime().exec(new String[]{"am","startservice","-n","com.android.systemui/.SystemUIService"});
                proc.waitFor();
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
    });

    // Hiding System bar
    hideSystemBarBtn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {

            try {
                Process proc = Runtime.getRuntime().exec(new String[]{"su","-c","service call activity 79 s16 com.android.systemui"});
                proc.waitFor();
            } catch(Exception e){
                e.printStackTrace();
            }
        }
    });

どうすれば問題を解決できますか?

4

1 に答える 1