android - LAYER_TYPE_SOFTWARE not disables HW acceleration on some devices in some time -


i use clippath clip round canvas , drive:

@override protected void ondraw(canvas canvas)  {        float radius = ((float) getwidth()) / 2;     clippath.reset();     clippath.addcircle(radius, radius, radius, path.direction.cw);     canvas.clippath(clippath);     super.ondraw(canvas); } 

of couse, set view.layer_type_software view in constructor , in xml.

but on devices (android 3):

lenovo k1 acer a501 samsung gt-p6200 zte v9s 

throwns exception when try draw clipped canvas:

java.lang.unsupportedoperationexception @ android.view.gles20canvas.clippath(gles20canvas.java:303) @ com.myapp.ui.roundedcornerimageview.ondraw(roundedcornerimageview.java:35) @ android.view.view.draw(view.java:9292) @ android.view.view.getdisplaylist(view.java:8755) @ android.view.viewgroup.dispatchgetdisplaylist(viewgroup.java:2296) @ android.view.view.getdisplaylist(view.java:8719) @ android.view.viewgroup.drawchild(viewgroup.java:2554) @ android.view.viewgroup.dispatchdraw(viewgroup.java:2189) @ android.view.view.getdisplaylist(view.java:8753) @ android.view.viewgroup.drawchild(viewgroup.java:2554) @ android.view.viewgroup.dispatchdraw(viewgroup.java:2189) @ android.widget.abslistview.dispatchdraw(abslistview.java:2029) @ android.view.view.draw(view.java:9399) @ android.widget.abslistview.draw(abslistview.java:3315) @ android.view.view.getdisplaylist(view.java:8755) @ android.view.viewgroup.dispatchgetdisplaylist(viewgroup.java:2296) @ android.view.view.getdisplaylist(view.java:8719) @ android.view.viewgroup.dispatchgetdisplaylist(viewgroup.java:2296) @ android.view.view.getdisplaylist(view.java:8719) @ android.view.viewgroup.dispatchgetdisplaylist(viewgroup.java:2296) @ android.view.view.getdisplaylist(view.java:8719) @ android.view.viewgroup.dispatchgetdisplaylist(viewgroup.java:2296) @ android.view.view.getdisplaylist(view.java:8719) @ android.view.viewgroup.dispatchgetdisplaylist(viewgroup.java:2296) @ android.view.view.getdisplaylist(view.java:8719) @ android.view.viewgroup.dispatchgetdisplaylist(viewgroup.java:2296) @ android.view.view.getdisplaylist(view.java:8719) @ android.view.viewgroup.dispatchgetdisplaylist(viewgroup.java:2296) @ android.view.view.getdisplaylist(view.java:8719) @ android.view.viewgroup.dispatchgetdisplaylist(viewgroup.java:2296) @ android.view.view.getdisplaylist(view.java:8719) @ android.view.hardwarerenderer$glrenderer.draw(hardwarerenderer.java:691) @ android.view.viewroot.draw(viewroot.java:1624) @ android.view.viewroot.performtraversals(viewroot.java:1440) @ android.view.viewroot.handlemessage(viewroot.java:2070) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:132) @ android.app.activitythread.main(activitythread.java:4143) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:491) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:852) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:610) @ dalvik.system.nativestart.main(native method) 

interestingly, app crashes not immediately, after time. stack above start time 2013-03-31 16:04:04, crashe time 2013-03-31 16:18:47. although roundedcornerimageview displayed @ mainactivity!

i found bug: http://code.google.com/p/android/issues/detail?id=20474

it fixed in in 4.1 (api 16).

i decide turn on hw acceleration api 16 , higher

in manifest:

android:hardwareaccelerated="@bool/hw_acceleration" 

in values/constants.xml:

<bool name="hw_acceleration">false</bool> 

in values-16/constants.xml:

<bool name="hw_acceleration">true</bool> 

i hope, works!


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -