Issue 100: java.lang.NullPointerException at android.graphics.Matrix.preConcat(Matrix.java:233)
Status:  Fixed
Owner: ----
Closed:  Oct 2011
Reported by j...@toro-asia.com, Sep 22, 2011
What steps will reproduce the problem?
1. With Android 2.3.4
2. at org.microemu.android.device.ui.AndroidCanvasUI$CanvasView.onDraw(AndroidCanvasUI.java:225)
3. at org.microemu.android.device.AndroidDisplayGraphics.reset(AndroidDisplayGraphics.java:96)
4. at android.view.Surface$CompatibleCanvas.setMatrix(Surface.java:259)
5. java.lang.NullPointerException at android.graphics.Matrix.preConcat(Matrix.java:233)

What is the expected output? 

No error in here.

What do you see instead?

The full application crashes!!

What version of the product are you using? 

Android 2.3.4

On what operating system?

Android 2.3.4


Please provide any additional information below.

Look like this is a bug in Android itself. They say:

http://developer.android.com/reference/android/graphics/Canvas.html#setMatrix%28android.graphics.Matrix%29

"If the matrix parameter is null, then the current matrix is reset to identity."

In "microemu-android\src\org\microemu\android\device\AndroidDisplayGraphics.java" at 96, the line shows as:

this.canvas.setMatrix(null);

so that, this patch fixes their problem:

try { this.canvas.setMatrix(null); } catch(Throwable e) { }

I have attached the fixed file.

Best regards,

Jose
AndroidDisplayGraphics.java
15.3 KB   View   Download
Sep 22, 2011
#1 j...@toro-asia.com
I forgot mention the fix is for the MicroEmulator 3.0.0
Oct 17, 2011
Project Member #2 bar...@gmail.com
Fixed in trunk. Modified the fix a bit not to throw exception.
Status: Fixed
Labels: Milestone-3.0