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 7831477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:44:59+00:00 2026-06-02T11:44:59+00:00

I have run into a very interesting situation. I have access to two devices

  • 0

I have run into a very interesting situation. I have access to two devices and one of them is one of the most top notch androids out there (Galaxy Note) and the other is a decent little HTC Inspire. Now thanks to the difference in these two devices, I was able to notice that the Galaxy Note loads my application fine, but the Inspire returns an outofmemoryexception. And the stack trace suggests that it is the Bitmaps in my code. I have 5 bitmaps that are very high res (like 1280 x 800). And i initialize each of them in the surfaceview’s constructor. I know that is a dumb idea, but my Note is able to handle the load. However, crappier devices can’t handle all that Bitmap data. How do i solve my problem? I can lower the resolution but thats the last resort. Here is code similar to mine:

static public class GraphicsView extends SurfaceView implements Runnable {

    Thread t;
    SurfaceHolder holder;
    boolean sentinel = false;
    Bitmap b1, b2, b3, b4, b5;

    public GraphicsView(Context context) {
        super(context);
        holder = getHolder();
        b1 = BitmapFactory.decodeResource(getResources(), R.drawable.i);
        b2 = BitmapFactory.decodeResource(getResources(), R.drawable.like);
        b3 = BitmapFactory.decodeResource(getResources(), R.drawable.csharp);
        b4 = BitmapFactory.decodeResource(getResources(), R.drawable.python_and);
        b5 = BitmapFactory.decodeResource(getResources(), R.drawable.java);
        /**
        *
        * This is where the exceptions come!
        *
        **/
    }       

    public void run() {
        while (sentinel) {
            if(!holder.getSurface().isValid()) {
                continue;
            }
            try {
                Canvas canvas = holder.lockCanvas();
                //Drawing commands go here...ommited. These commands may use any of the 5 bitmaps                   
                holder.unlockCanvasAndPost(canvas);
            }catch(Exception e) {
                //Excpetion handling...its not getting here anyways
            }
        }
    }
    //More code below...Ommited...
} 
  • 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-06-02T11:45:02+00:00Added an answer on June 2, 2026 at 11:45 am

    My solution was Bitmap.createScaledBitmap(b1, width, height, true);

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

Sidebar

Related Questions

I am modifying a wordpress theme completely, and have run into one very simple
I have run into a very interesting problem trying to debug my custom PHP
I have run into a very confusing situation with maps on the iPhone. Everything
I have run into a very strange behaviour I can’t make sense of. I
I've recently started using GNU Screen but have run into a very annoying problem.
I've been coding a very sizable project and I have run into trouble with
I have run into a situation where I want to ensure that a compound
I have run into a situation where I need to take all the extra
I have run into an interesting bug where it appears that when you select
I have run into an interesting dilema. In a DataMapper class, I am generating

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.