質問

I am getting this error:

E/libEGL(11261): call to OpenGL ES API with no current context (logged once per thread)

I found out that a possible solution would be to use

android:hardwareAccelerated="true"

But the issue is that I want to run the app on android 2.2 up.

If I add that setting to the AndroidManifest.xml, it won't compile because it will give an error.

Is there a way to enable that option based on device version, or maybe use a different solution?

I am using phonegap.

edit:

found the solution, i didn't had the deviceready listener running

役に立ちましたか?

解決

Try with this .

 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) {
getWindow().setFlags(
                    WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
                    WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
    (your view)view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }

AndroidManifest.xml

  <application
        android:hardwareAccelerated="true">

他のヒント

You can do this using reflection to call window's method:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);

Actually, the method is available in 2.2, but constants values are not. You can hard-code them or use the reflection.

See http://developer.android.com/guide/topics/graphics/hardware-accel.html for more details on per-view hardware acceleration control.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top