Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnsupportedOperationException on clipPath

I am getting an UnsupportedOperationException when using Canvas clipPath.

This is happening on an HTC Sensation XE (4.0.3). It works perfectly on other 4.0.3 devices.

This is the code:

    @Override
protected void dispatchDraw(Canvas canvas) {
    canvas.save();
    canvas.clipPath(this._mClip);
    super.dispatchDraw(canvas);
    canvas.restore();
}

It fails on the "clipPath" with the following stack:

11-06 12:05:53.650: E/AndroidRuntime(25021): FATAL EXCEPTION: main

11-06 12:05:53.650: E/AndroidRuntime(25021): java.lang.UnsupportedOperationException
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.GLES20Canvas.clipPath(GLES20Canvas.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at com.applicat.meuchedet.views.RoundedListView.dispatchDraw(RoundedListView.java:76)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.draw(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.widget.AbsListView.draw(AbsListView.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.widget.ListView.draw(ListView.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.drawChild(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.drawChild(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.draw(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.drawChild(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.drawChild(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.drawChild(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.draw(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.widget.FrameLayout.draw(FrameLayout.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.View.getDisplayList(View.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewRootImpl.draw(ViewRootImpl.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.os.Handler.dispatchMessage(Handler.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.os.Looper.loop(Looper.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at android.app.ActivityThread.main(ActivityThread.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at java.lang.reflect.Method.invokeNative(Native Method)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at java.lang.reflect.Method.invoke(Method.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
11-06 12:05:53.650: E/AndroidRuntime(25021):    at dalvik.system.NativeStart.main(Native Method)
like image 620
theblitz Avatar asked Dec 20 '22 13:12

theblitz


2 Answers

you can control hardware accelerations for individual activities by editing manifest file as either

<application android:hardwareAccelerated="true">
<activity ... />
<activity android:hardwareAccelerated="false" />

like image 121
karts Avatar answered Feb 06 '23 18:02

karts


There is an answer here. In short: Its no longer supported but you can still use it if you disable hardware acceleration. See post for more info.

like image 41
Warpzit Avatar answered Feb 06 '23 18:02

Warpzit