Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6700821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:51:37+00:00 2026-05-26T06:51:37+00:00

I’m trying to display 2 images on a canvas. I’ve loaded one, and it

  • 0

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.

Both images are PNGs and are in res/drawable-mdpi.

Loading images:

private Bitmap stageBMP=BitmapFactory.decodeResource(getResources(), R.drawable.stagel);
private Bitmap magBMP = BitmapFactory.decodeResource(getResources(), R.drawable.mag);

Displaying images:

canvas.drawBitmap(stageL, 300,300, null);
canvas.drawBitmap(magBMP, 300,300, null);

If I comment out the final line, the app loads (displaying only the first image). Instead of displaying magBMP I show stageL twice, it works.

Working image:

Working image

Incompatible image:

Incompatible image

Stacktrace:

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:51:38+00:00Added an answer on May 26, 2026 at 6:51 am

    OK, I managed to find a solution.

    Instead of loading images in one class and passing them to another to be displayed, I passed the context to the second class, and loaded them and displayed them there.

    I confess I don’t really understand why this should work, but for a scrappy solution it’ll do for now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to select an H1 element which is the second-child in its group
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.