title: How to run OpenCV code without OpenCv Manager
body: <p>I am using OpenCV4Android version 2.4.10 and i test my code on Samsung Galayx GT-I9300. the problem i have is, that i must download Opencv Manager from play store so that my opencv code runs, otherwise the App would not start.
  I referred to some postes "as shown here <a href="https://stackoverflow.com/questions/20259309/how-to-integrate-opencv-manager-in-android-app">How to integrate OpenCV Manager in Android App</a>" to know how can i run the opncv code on android without the need to download OpenCV manager
  but unfortunately the App doesnt start as long as OpenCV Manager is not installed.</p>
  
  <p>i tried the follwoing</p>
  
  <pre><code>static {
      if (!OpenCVLoader.initDebug()) {
          // Handle initialization error
      }
  }
  
  private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
      @Override
      public void onManagerConnected(int status) {
          switch (status) {
              case LoaderCallbackInterface.SUCCESS:
              {
                  Log.i(TAG, "OpenCV loaded successfully");
                  mOpenCvCameraView.enableView();
              } break;
              default:
              {
                  super.onManagerConnected(status);
              } break;
          }
      }
  };
  ...
  ...
  ...
  
  @Override
  public void onResume() {
      super.onResume();
      Log.w(TAG, "onResume");
  
      if (!OpenCVLoader.initDebug()) {
          Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
          OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_10, getActivity(), mLoaderCallback);
      } else {
          Log.d(TAG, "OpenCV library found inside package. Using it!");
          mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
      }
  }
  </code></pre>
  
  <p>but that did not solve the problem.
  Please let me know how to run opencv code on android without downloading Opencv Manager ?</p>
  
  <p><strong>Update</strong>:</p>
  
  <p><strong>use of initAsync</strong>:</p>
  
  <p>would you please provide an example how to use "initAsync()" in the production version of the App? because i tried to do it but of course i cant use it in the static block because the signature of "intiAsync" is as follows "OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_10, this, mLoaderCallback);" and i cant use "this" keyword nor a reference to the callback "mLoaderCallback" inside the static block</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  static {
      //OpenCVLoader.initDebug();
      OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_10, this, mLoaderCallback); //this keyword and "mLoaderCallback" are not defined in this scope
  }
  
  private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
      @Override
      public void onManagerConnected(int status) {
          switch (status) {
              case LoaderCallbackInterface.SUCCESS: {
                  Log.i("MainActivity", "OpenCV loaded successfully");
              }
              break;
              default: {
                  super.onManagerConnected(status);
              }
              break;
          }
      }
  };
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      Mat m = new Mat(100, 100, CvType.CV_8UC4);
      Log.d("MainActivity", "m.width()" + m.width());
      Log.d("MainActivity", "m.height()" + m.height());
  }
  }
  </code></pre>