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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:07:40+00:00 2026-05-26T16:07:40+00:00

I have an application with an embedded drawable 48×48 pixel at 71,12 pixels/inch I

  • 0

I have an application with an embedded drawable 48×48 pixel at 71,12 pixels/inch
I load the same image via a stream to a webserver, then load that stream

return new BitmapDrawable(getActivity().getResources(), new ByteArrayInputStream(imageThumbnail));

the displayed result is:

screenshot

How can i get the BitmapDrawable to scale the same as the rest of the drawables?

  • 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-26T16:07:41+00:00Added an answer on May 26, 2026 at 4:07 pm

    Do something like this:

    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    
    Bitmap bitmapOrg = new BitmapDrawable(getResources(), new  ByteArrayInputStream(imageThumbnail)).getBitmap();
    
    int width = bitmapOrg.getWidth();
    int height = bitmapOrg.getHeight();
    
    float scaleWidth = metrics.scaledDensity;
    float scaleHeight = metrics.scaledDensity;
    
    // create a matrix for the manipulation
    Matrix matrix = new Matrix();
    // resize the bit map
    matrix.postScale(scaleWidth, scaleHeight);
    
    // recreate the new Bitmap
    Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0, width, height, matrix, true);
    

    Or

    Maybe try a differnet approach… try setting the height and width of images in the XML layout in dips, I am guessing you have the ImageView with wrap_content height and width at the moment, try setting the height and width to 48dip

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

Sidebar

Related Questions

I have an embedded application where an image scanner sends out a stream of
I have an application which embedes (via BuildAction: Embedded Resource) referenced assembly (called ClassLibrary1)
We have an embedded application, now it requires its state to be saved and
I have application running for hours in embedded Linux, when suddenly the OOM Killer
I have an application that has Powershell 1 embedded into it, but we need
In an embedded application, we have a table describing the various address ranges that
I have an application in C# (2.0 running on XP embedded) that is communicating
I have an application that prints by generating text files with embedded printer codes,
I have an application that sends an HTML formatted email with embedded images. The
I have an application on the Compact Framework that has some large embedded resources

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.