1

i saw crash reports of my application on play store and , i have no idea about this issue. i want to understand that If i use "hardwareAccelerated false" , is it useful method?. or what is the reason of this problem? how can i solve this problem. devices that have 4.0.3 and 4.0.4 are came across with this crash

crash log : https://gist.github.com/semihozkoroglu/30be3fda7257d002e2fe

java.lang.NullPointerException
at android.view.GLES20RecordingCanvas.drawBitmap(GLES20RecordingCanvas.java:118)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:393)
at android.view.View.draw(View.java:10968)
at android.view.ViewGroup.drawChild(ViewGroup.java:2887)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at com.slidingmenu.lib.CustomViewAbove.dispatchDraw(CustomViewAbove.java:1067)
at android.view.View.draw(View.java:10986)
at android.view.View.getDisplayList(View.java:10422)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10385)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10385)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10385)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10385)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10385)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:849)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:1910)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1634)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

Thank you.

semih
  • 821
  • 8
  • 16

2 Answers2

0

I believe you can fix this problem by using one of the drawBitmap methods that accepts as an argument the rectangle of the source image you want to render. It's a bug in a few specific versions of Android, where the default behaviour of drawing the whole image to the canvas doesn't work.

Assuming you want the whole bitmap drawn, your code might look like this:

canvas.drawBitmap(bitmap, new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()), bitmapPosition, paint);
Dave Morrissey
  • 4,371
  • 1
  • 23
  • 31
  • hi @dave, thanks for reply but, i can't render any image, i am only using ImageView on SlidingMenu left menu. And this crash happened when the base class calles com.slidingmenu.lib.CustomViewAbove.dispatchDraw, i think that this problem is about OpenGL ES 2.0. Maybe you can check it out – semih Jun 05 '14 at 13:17
  • 1
    You may have to fallback to disabling hardware acceleration for specific versions of Android, and if you support older versions you'll need to use reflection to do it. See http://developer.android.com/guide/topics/graphics/hardware-accel.html – Dave Morrissey Jun 05 '14 at 13:34
0

If you use animation, maybe you can try post “remove the view” to UI thread? I met the same stack as you. But I think this is the root cause.

How to remove a View when animation ends?

Community
  • 1
  • 1
jiangyan.lily
  • 932
  • 1
  • 8
  • 16