안녕하세요!
똑같은 로직에서 가끔, 한번씩 에러가 발생하는데, 어떤 이유인지 궁금합니다 ㅜㅜ
검색을 해보면 context에러라고 하는 것 같기는 한데, 혹시 아시는분 계시면 조언 부탁드립니다.
기본 로직은 아래와 같습니다. 에러가 난다고 추측되는 부분은 이렇게 1~5번 사이에 있습니다.
1. 앱 실행(ActivitySplashScreen.java , fragmentactivity)
2. "private ProgressDialog pDialog"선언
3. 아래 코드를 통해 progressDialog를 띄웁니다.
if(pDialog == null){
pDialog = new CustomProgressDialog(ActivitySplashScreen.this);
pDialog.show();
}
4. volley의 jsonobjectrequst를 통해 통신.
5. 결과값이 제대로 되건 말건, 혹은 통신이 성공하던 말던간에, 어쨋든 아래와 같은 코드를 실행.
if(pDialog != null) pDialog.dismiss();
에러로그에 나오는 CustomProgressDialog.java:23 줄 은,
21 : @Override
22 : public void show() {
23 : super.show();
24 : }
입니다.
조언 부탁드립니다 ㅜㅜ
android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@42268190 is not valid; is your activity running?
at android.view.ViewRootImpl.setView(ViewRootImpl.java:769)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:278)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.Dialog.show(Dialog.java:289)
at com.revolutionists.util.CustomProgressDialog.show(CustomProgressDialog.java:23)
at com.revolutionists.main.ActivitySplashScreen.loadStoreData(ActivitySplashScreen.java:289)
at com.revolutionists.main.ActivitySplashScreen.access$2(ActivitySplashScreen.java:284)
at com.revolutionists.main.ActivitySplashScreen$3$1.onResponse(ActivitySplashScreen.java:223)
at com.revolutionists.main.ActivitySplashScreen$3$1.onResponse(ActivitySplashScreen.java:1)
at com.android.volley.toolbox.JsonRequest.deliverResponse(JsonRequest.java:65)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)