Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid force closing app on particular image. How can I track the issue down?
    primarykey
    data
    text
    <p>I'm trying to display 2 images on a canvas. I've loaded one, and it works fine. The second I've created, loaded and am displaying in the same manner, but the app force closes each time.</p> <p>Both images are PNGs and are in res/drawable-mdpi.</p> <p>Loading images:</p> <pre><code>private Bitmap stageBMP=BitmapFactory.decodeResource(getResources(), R.drawable.stagel); private Bitmap magBMP = BitmapFactory.decodeResource(getResources(), R.drawable.mag); </code></pre> <p>Displaying images:</p> <pre><code>canvas.drawBitmap(stageL, 300,300, null); canvas.drawBitmap(magBMP, 300,300, null); </code></pre> <p>If I comment out the final line, the app loads (displaying only the first image). Instead of displaying <code>magBMP</code> I show <code>stageL</code> twice, it works.</p> <p>Working image:</p> <p><img src="https://i.stack.imgur.com/RN7Oa.png" alt="Working image"></p> <p>Incompatible image:</p> <p><img src="https://i.stack.imgur.com/w20uk.png" alt="Incompatible image"></p> <p>Stacktrace:</p> <pre><code>10-17 19:23:03.233: DEBUG/RobotronActivity(746): View added 10-17 19:23:03.403: DEBUG/MainThread(746): Starting game loop 10-17 19:23:03.543: WARN/dalvikvm(746): threadid=9: thread exiting with uncaught exception (group=0x40014760) 10-17 19:23:03.543: ERROR/AndroidRuntime(746): FATAL EXCEPTION: Thread-10 10-17 19:23:03.543: ERROR/AndroidRuntime(746): java.lang.NullPointerException 10-17 19:23:03.543: ERROR/AndroidRuntime(746): at android.graphics.Canvas.throwIfRecycled(Canvas.java:999) 10-17 19:23:03.543: ERROR/AndroidRuntime(746): at android.graphics.Canvas.drawBitmap(Canvas.java:1040) 10-17 19:23:03.543: ERROR/AndroidRuntime(746): at com.cjs.robotron.Droid.draw(Droid.java:28) 10-17 19:23:03.543: ERROR/AndroidRuntime(746): at com.cjs.robotron.MainGamePanel.onDraw(MainGamePanel.java:108) 10-17 19:23:03.543: ERROR/AndroidRuntime(746): at com.cjs.robotron.MainThread.run(MainThread.java:52) 10-17 19:23:03.566: WARN/ActivityManager(73): Force finishing activity com.cjs.robotron/.RobotronActivity 10-17 19:23:03.566: WARN/WindowManager(73): Failure taking screenshot for (216x135) to layer 21020 10-17 19:23:04.073: WARN/ActivityManager(73): Activity pause timeout for ActivityRecord{407afbf0 com.cjs.robotron/.RobotronActivity} 10-17 19:23:04.213: WARN/InputManagerService(73): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@406a7738 (uid=10036 pid=746) 10-17 19:23:04.223: WARN/InputManagerService(73): Client not active, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40eefcf8 10-17 19:23:04.913: INFO/ActivityManager(73): Displayed com.cjs.robotron/.RobotronActivity: +3s510ms 10-17 19:23:10.893: DEBUG/dalvikvm(221): GC_EXPLICIT freed 18K, 5% free 6274K/6599K, paused 3ms+3ms 10-17 19:23:14.797: WARN/ActivityManager(73): Activity destroy timeout for ActivityRecord{407afbf0 com.cjs.robotron/.RobotronActivity} 10-17 19:23:15.973: DEBUG/dalvikvm(325): GC_EXPLICIT freed 8K, 6% free 6198K/6531K, paused 3ms+3ms </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload