Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

you're not loading the opencv c++ native libs, so your code can't run. also, you can't run any opencv code from onCreate, since you have to wait, until the (async)loading finished. you need to add something similar to this:

private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        if (status == LoaderCallbackInterface.SUCCESS ) {
            // now we can call opencv code !
            run(....); // some args
        } else {
            super.onManagerConnected(status);
        }
    }
};

@Override
public void onResume() {;
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_1,this, mLoaderCallback);
    // you may be tempted, to do something here, but it's *async*, and may take some time,
    // so any opencv call here will lead to unresolved native errors.
}