title: Unable to resume activity - Runtime exception
body: <pre><code>     @Override
              public void onResume()
              {
                  super.onResume();
                  OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_7, this, mLoaderCallback);
              }
  
              public void onDestroy() {
                  super.onDestroy();
  
              }
  
          private BaseLoaderCallback  mLoaderCallback = new BaseLoaderCallback(this) {
                  @Override
                  public void onManagerConnected(int status) {
                      switch (status) {
                          case LoaderCallbackInterface.SUCCESS:
                          {
  
                              Log.i(TAG, "OpenCV loaded successfully...................");
                          }
    } 
                      default:
                      {
                          super.onManagerConnected(status);
                      } break;
                  }
              }
          };
  </code></pre>
  
  <p>here is my log </p>
  
  <blockquote>
    <p>0java.lang.RuntimeException: Unable to resume activity
    {com.example.lowfreq/com.example.lowfreq.Sample}:
    android.view.WindowManager$BadTokenException: Unable to add window --
    token android.os.BinderProxy@41b9aca8 is not valid; is your activity
    running? 1    at
    android.app.ActivityThread.performResumeActivity(ActivityThread.java:2814)
    2 at
    android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2843)
    3 at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2278)
    4 at android.app.ActivityThread.access$800(ActivityThread.java:138)
    5 at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1236)
    6 at android.os.Handler.dispatchMessage(Handler.java:102) 7   at
    android.os.Looper.loop(Looper.java:149) 8 at
    android.app.ActivityThread.main(ActivityThread.java:5045) 9   at
    java.lang.reflect.Method.invokeNative(Native Method) 10   at
    java.lang.reflect.Method.invoke(Method.java:515) 11   at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
    12    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
    13    at dalvik.system.NativeStart.main(Native Method) 14Caused by:
    android.view.WindowManager$BadTokenException: Unable to add window --
    token android.os.BinderProxy@41b9aca8 is not valid; is your activity
    running? 15   at
    android.view.ViewRootImpl.setView(ViewRootImpl.java:561) 16   at
    android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259)
    17    at
    android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
    18    at android.app.Dialog.show(Dialog.java:287) 19  at
    org.opencv.android.BaseLoaderCallback.onPackageInstall(BaseLoaderCallback.java:110)
    20    at
    org.opencv.android.AsyncServiceHelper.InstallService(AsyncServiceHelper.java:116)
    21    at
    org.opencv.android.AsyncServiceHelper.initOpenCV(AsyncServiceHelper.java:32)
    22    at org.opencv.android.OpenCVLoader.initAsync(OpenCVLoader.java:60)
    23    at com.example.lowfreq.Sample.onResume(Sample.java:189) 24  at
    android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1194)
    25    at android.app.Activity.performResume(Activity.java:5315) 26    at
    android.app.ActivityThread.performResumeActivity(ActivityThread.java:2804)</p>
  </blockquote>
  
  <p>Is there any mistake in the way OPEN CV is initialized?</p>