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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:03:32+00:00 2026-06-03T16:03:32+00:00

I’m experiencing an intermittent crash in my Android application running on a Droid X

  • 0

I’m experiencing an intermittent crash in my Android application running on a Droid X 2.3.4, using Cordova 1.6.1. I’ve created a sample project (http://bit.ly/IWxTv7) that clearly demonstrates the error on the device, but only intermittently. It’s happening frequently enough that if you run the sample and repeat picking a photo, after about 6 attempts you should see the crash. Also note that this functions correctly on iOS and other Android devices, so the fact that it’s intermittent and device/OS specific has me puzzled.

Description of expected functionality:
The sample allows the user to pick a photo from the library or camera and shows it in an image element on the page. The real application works differently, but this isolates the problem.

What the code is doing:
A click handler on a button is calling the navigator.camera.getPicture method with a FILE_URI destination type. After a photo is picked, the system uses the resulting temporary URI to read the image data and copy it to a persistent location. This uses the readAsDataURL method on the FileReader object. When it works, it takes the result and saves it to a persistent location using the write method on the FileWriter object. When that completes, it returns the URI for the persistent location to the button click event handler, which sets the src attribute of an image element to the persistent URI. (That part doesn’t work, probably because I’m not using it correctly, but it’s not relevant to the real app, so I didn’t bother troubleshooting and don’t need an answer to why that doesn’t work.)

The crash:
Run the app, tap the “Photo” button in the footer. When the photo page loads, tap the “Get from camera” or “Get from library” button. Pick a photo and return to the app. If the process completes successfully, the image element will display a broken image icon. If the process didn’t complete successfully, the UI will remain as is, or the application will crash.

My analysis:
The application crashes intermittently when attempting to execute FileReader.readAsDataURL. I’ve come to this conclusion because it’s always the last log entry I see before it crashes. However, in the past I’ve seen log entries from stuff that’s executed successfully not show up in the console because of an error downstream, so I’m not 100% sure that’s the cause, just a hypothesis. The crash is intermittent, but I was able to reproduce pretty quickly, within 6 attempts. Sometimes it succeeds, but when it fails it appears to always do so when trying to execute readAsDataURL.

Has anyone else encountered errors or crashes attempting to read a local file this way? What is up and how do I fix this? Alternate solutions or workarounds must give me access to the base 64 encoded image data.

  • 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-03T16:03:34+00:00Added an answer on June 3, 2026 at 4:03 pm

    If you had the output of “adb logcat” I could probably pinpoint this issue for you but for now I will have to tell you what I suspect. The camera on a Droid X is 8 MP which means it takes a picture of pretty high quality and the file size can be quite large. Now when you attempt to read the file as Base64 encoded data the size of the data gets even larger as base64 imposes a 33% overhead.

    So what I suspect is happening is that your application is throwing an OutOfMemoryException and crashing. Sadly you cannot catch and OOM exception so there is nothing to be done except re-work the app to use less memory.

    You may want to look at reducing the width/height or quality of the picture to reduce the overall file size. Alternatively, just set your image tag to the FILE_URI you get rather than doing any base64 encoding.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am currently running into a problem where an element is coming back from

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.