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

The Archive Base Latest Questions

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

Am having a bitmap , so I want to upload a webserivceas string and

  • 0

Am having a bitmap , so I want to upload a webserivceas string and want to retrive the string.

For converting bitmap to string am using:

ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();

strBase64 = Base64.encodeToString(byteArray, Base64.URL_SAFE);

this above String is using as property to in soapobject to upload.

But am getting Out of memory on a 11674900-byte allocation, while print and uploading.

And if i debugged the issue, without printing am getting

com.sun.jdi.InvocationException occurred invoking method.

on soaprequest.

How to resolve this issue and to upload image to webservice as string ?

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

    You are creating 3 copies of an 11MB image(bitmap, stream, strBase64). So reduce the memory usage by calling

    bitmap.recycle();
    

    below this line:

    bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
    

    Also close the stream when you are done with it(below stream.toByteArray();):

    stream.close();
    stream = null;
    

    Remember that there is no guarantee that memory will be cleaned immediately after these calls. Proper way to handle this type of situation is to transfer large files chunk by chunk.

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

Sidebar

Related Questions

Im having a hard time converting cdr files to jpgs for previews using c#.net.
im having a single Bitmap in a surfaceview. I am using multi touch to
I want to read a pbm (portable bitmap format) image having depth one bit
Having to upgrade a database schema makes installing a new release of software a
I'm using the Allegro game library to make a tile game. I want the
I want to send an Android Bitmap to a printer (Mobile Bluetooth Printer Bixolon
I'm having some trouble using resource files. In my project I'm using a bunch
http://imageshack.us/photo/my-images/189/unledgev.png/ i h'v having problem with finding the radius of this circle. i converted
I'm having a strange problem - I have about 14.5 million bitmap images, that
We're having problems with an ASP.NET application which allows users to upload, and crop

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.