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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:02:31+00:00 2026-06-18T11:02:31+00:00

Edit: When I save those bytes in the txt file and when I save

  • 0

Edit:
When I save those bytes in the txt file and when I save it as png file , it shows the image, but it is not working here why…?

I am using this code to create image from byte array
on doInBackground()

String base64data=StringEscapeUtils.unescapeJava(IOUtils.toString(resp.getEntity().getContent()));
base64data=base64data.substring(1,base64data.length()-1);
JSONObject obj=new JSONObject(base64data);
JSONArray array=obj.getJSONArray("EMRTable");
JSONObject childobj=array.getJSONObject(0);
results=childobj.getString("DocumentInternalFormat");

and onPostExecute

if(jsondata!=null) {
    receiveData(jsondata);
}

There is no error in the logcat, even there is no exception in it..but the image isn’t showing. I have also did like this

String data=(String)object;
data=data.trim();
byte[] base64converted=Base64.decode(data,Base64.DEFAULT);          

ImageView image=new ImageView(context);
image.setImageBitmap(bmp);
setContentView(image);

but the result same image isn’t showing but there is no exception or an error, what is the problem…

The commented lines are when I try to store those bytes into text file and when I pull the file, it shows the images with windows default image viewer.

  • 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-18T11:02:33+00:00Added an answer on June 18, 2026 at 11:02 am

    Try this code while getting bitmap from different resources…

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeByteArray(base64converted,0,base64converted.length,options);
    
    // Calculate inSampleSize
    options.inSampleSize = calculateInSampleSize(options, 500, 500);
    // Decode bitmap with inSampleSize set
    options.inJustDecodeBounds = false;
    Bitmap bmp1=BitmapFactory.decodeByteArray(base64converted,0,base64converted.length,options);
    

    follow the tutorial on this link Efficient way to show bitmaps

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

Sidebar

Related Questions

I've been trying to save to a property list file, however it's not working
Is there any external library using which one can edit and save XML files
How to edit the .fla file code and save it in the .swf format?
SELECT works, Edit button works, but after editing, when I press Save the Grid
On one of my packages, which was adapted from another using Save-As and edit,
Example form, https://stackoverflow.com/questions/ask and I save this page to desktop. Then I edit the
EDIT: For those who are seeing this now, we've since solved the problem. See
I write a desktop application that can open / edit / save documents. Those
This must be an easy question for those who are not new to Wordpress
I've a UITableViewController which has Edit/Save and cancel buttons. At present I'm displaying 5

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.