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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:13:44+00:00 2026-06-17T14:13:44+00:00

I’m trying to display an image having it’s absolute path. I came upon this

  • 0

I’m trying to display an image having it’s absolute path. I came upon this code on stackoverflow which should theoretically work, however I get error Bitmap too big to be uploaded into a texture on most images so I’m looking for another way to do it. Surprisingly there aren’t any examples apart from this one on how to do it.

This is what I am trying:

Bitmap myBitmap = BitmapFactory.decodeFile(imagePath);                  
ImageView image = new ImageView(context);
image.setImageBitmap(myBitmap);
layout.addView(image);

By the way the images I’m working with have been taken with the default camera app so they don’t have any uncommon format or size (and can be seen with no problem on the gallery app). How can I add them to my layout?

  • 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-17T14:13:45+00:00Added an answer on June 17, 2026 at 2:13 pm

    Just try to resize your image first by using below code and then set it into the ImageView:

     public static Drawable GetDrawable(String newFileName)
    {
        File f;
        BitmapFactory.Options o2;
        Bitmap drawImage = null;
        Drawable d = null;
        try
        {           
            f = new File(newFileName);          
            //decodes image and scales it to reduce memory consumption
            //Decode image size
            BitmapFactory.Options o = new BitmapFactory.Options();
            o.inJustDecodeBounds = true;            
            o.inTempStorage = new byte[16 * 1024];          
            BitmapFactory.decodeStream(new FileInputStream(f), null, o);            
            //The new size we want to scale to
            final int REQUIRED_SIZE = 150;          
            //Find the correct scale value. It should be the power of 2.
            int scale = 1;
            while ((o.outWidth / scale / 2 >= REQUIRED_SIZE) && (o.outHeight / scale / 2 >= REQUIRED_SIZE))
                scale *= 2;         
            //Decode with inSampleSize
            o2 = new BitmapFactory.Options();
            o2.inSampleSize = scale;            
            drawImage = BitmapFactory.decodeStream(new FileInputStream(f), null, o2);
            //Bitmap bmp = pictureDrawableToBitmap((PictureDrawable) drawable);         
            d = new BitmapDrawable(drawImage);
            //drawImage.recycle();
            //new BitmapWorkerTask          
        }
        catch (FileNotFoundException e)
        {
        }
        return d;
    }
    

    Use the above method as below:

    imageView.setImageBitmap(myBitmap);

    • 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
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to select an H1 element which is the second-child in its group
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Basically, what I'm trying to create is a page of div tags, each has
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.

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.