0

長い話ですが、ShutdownThreadディレクトリを呼び出して電話を再起動しようとしていますが、何らかの理由でコンテキストが気に入らないなど、このエラーが発生します...助けていただければ幸いです....

.NativeStart.main(Native Method)
     [exec] 05-23 16:32:36.354  5573  5573 W System.err: Caused by: android.view
.WindowManager$BadTokenException: Unable to add window android.view.ViewRoot$W@4
5985ae0 -- permission denied for this window type
     [exec] 05-23 16:32:36.362  5573  5573 W System.err:        at android.view.


/**
 * Request a clean shutdown, waiting for subsystems to clean up their
 * state etc.  Must be called from a Looper thread in which its UI
 * is shown.
 *
 * @param context Context used to display the shutdown progress dialog.
 * @param reason code to pass to the kernel (e.g. "recovery"), or null.
 * @param confirm true if user confirmation is needed before shutting down.
 */
public static void reboot(final Context context, String reason, boolean confirm) {
    mReboot = true;
    mRebootReason = reason;
    shutdown(context, confirm);
}
4

2 に答える 2

0

reboot()あなたの試しを呼び出しながらgetParent()、コンテキストパラメータを与えて見てください。

于 2011-05-24T05:41:35.650 に答える
0

AndroidManifestに次の権限を追加してみてください。お持ちでない場合は.

android.permission.SYSTEM_ALERT_WINDOW

于 2013-07-08T08:11:41.580 に答える