我从客户端远程获取以下信息,因此不知道他们使用的硬件等。
java.lang.IllegalArgumentException: View not attached to window manager
at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:355)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:200)
at android.view.Window$LocalWindowManager.removeView(Window.java:417)
at android.app.Dialog.dismissDialog(Dialog.java:279)
at android.app.Dialog.access$000(Dialog.java:72)
at android.app.Dialog$1.run(Dialog.java:108)
at android.app.Dialog.dismiss(Dialog.java:263)
at com..mysite.android.ActivityGame$1.onFinish(ActivityGame.java:154)
at android.os.CountDownTimer$1.handleMessage(CountDownTimer.java:118)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4203)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:799)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
这是由于ProgressDialog引起的。
progressDialog = new ProgressDialog( this );
progressDialog.setMessage(getString(R.string.get_ready));
progressDialog.setCancelable(false);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setMax(12);
progressDialog.show();
new CountDownTimer(3000, 250) {
@Override
public void onTick(long millisUntilFinished) {
//progressDialog.incrementProgressBy(1);
}
@Override
public void onFinish() {
progressDialog.dismiss(); //********* ERROR HAPPENS HERE *********
nextQuestion();
}
}.start();
在清单文件中,该 Activity 的外观如下所示。
<activity android:theme="@style/GameTheme" android:name=".ActivityGame" android:screenOrientation="portrait" android:launchMode="singleTask" android:configChanges="keyboardHidden|orientation"></activity>
那么这意味着什么呢?我认为这可能与 Activity 被销毁然后重新创建有关,但是正如您所看到的,我已经正确设置了 configChanges。