Search code examples
androidopencvrajawali

Activity becomes white/black after onResume()


I have a problem with my application, in my main activity I have a button which opens another activity that extends RajawaliActivity

public void onStartOpenCVViewActivity(View view) {
        Intent intent = new Intent(this, SelectSceneActivity.class);
        startActivity(intent);
}

When I return back from that activity, the main activity (and all other activities opened after) becomes all white (android 4.1.2 - samsung s3 mini) or black (sometimes after click, most of the time instantly) on android 4.4.4 (motorola moto g).

To be more precise, I can see proper overlay during onResume(), but then the 'white/black' overlay appears. Funny thing is that I can still click the buttons that are under the 'white/black overlay', and I can see parts of the GUI.GUI being visible through white 'overlay' After this 'overlay' appears, there is no way to get rid of it until I turn the application off and on again.

I am not doing any heavy calculation neither on onCreate(), nor on onResume (except loading OpenCV in onResume method: OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, this.mLoaderCallback); ) I don't see this problem on Android 5.1 (NVidia Shield tablet). Any tips what might cause this?


Solution

  • It seems that Rajawali has a bug somewhere while working with OpenGL thread. I don't quite understand what is the problem, but the workaround for me is turning off the hardware acceleration for the main activity, i.e. adding
    android:hardwareAccelerated="false"
    to the AndroidManifest.