Skip to content Skip to sidebar Skip to footer

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 c

Solution 1:

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

<applicationandroid:hardwareAccelerated="true"><activity... /><activityandroid:hardwareAccelerated="false" />

Solution 2:

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.

Solution 3:

Solution 4:

I ran into the same UnsupportedOperationException problem- when I had a view that tried to use Canvas clipPath(), it would crash only on devices running 4.0.3. You can see how I solved it here.

Solution 5:

As newer versions of Android do support clipPath() with hardware acceleration turned, this is probably a better solution:

try {
    canvas.clipPath(path);
} catch (UnsupportedOperationException exception) {
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    try {
        canvas.clipPath(path);
    } catch (UnsupportedOperationException exception2) {
        // shouldn't happen, but just in case 
    }
}

Post a Comment for "Unsupportedoperationexception On Clippath"