기본 콘텐츠로 건너뛰기

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;
        }
    }
};

댓글

이 블로그의 인기 게시물