기본 콘텐츠로 건너뛰기

Android OpenCV NDK loadlibrary function in static statement slow down problem

It is odd that when loading OpenCV NDK module in static statement makes app slow. Don't load the module like this.

 static {
     System.loadLibrary("ndk_module");
 }


Load NDK module at onManagerConnected() in BaseLoaderCallback.

private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
    @Override public void onManagerConnected(int status) {
        switch (status) {
            case LoaderCallbackInterface.SUCCESS: {
                System.loadLibrary("ndk_module");

                mOpenCvCameraView.enableView();
            }
            break;
            default: {
                super.onManagerConnected(status);
            }
            break;
        }
    }
};

댓글

이 블로그의 인기 게시물

Picasso vs Glide in Android

I started a new project with Picasso first, but had a problem with the orientation of photos. Picasso didn't display a photo properly according to it's orientation. So I changed to Glide which solve the problem. Use 'Glide' if you want to be safe about photo's orientation,