Saving Camera Image Error (Android)

Hi all,

I'm trying to save a photo taken with the camera to local storage (so that I can later reference it as a leftimage url in a tablerow like a thumbnail), but I keep coming up with the following error: Wrapped javalang.illegalStateException: Not yet implemented. TYPE_FILE

The I'm trying is below - can anyone spot what I'm doing wrong?

Titanium.Media.showCamera ({
  success:function(e) { 
    var dir = Titanium.Filesystem.getApplicationDataDirectory();
    var f = Titanium.Filesystem.getFile(dir,'testimage.png');
    if(f.exists()) {
  cancel:function(e) { alert ("Cancel") },
  error:function(e) { alert ("error") },
  allowImageEditing: true,
  saveToPhotoGallery: false

6 Answers

  • What version of the mobile SDK are you using?

    Also on Android you'll want to store images in the external storage area if possible. There is very limited space on the device itself.

  • Thanks for the reply.

    I'm using the Titanium 1.2.0 and Android 2.1.

    How would I go about using the external storage in the above code?


  • Use getExternalStorageDirectory on Android I actually store the file on the filesystem when it's returned from the camera. If you check the URL of the blob you get back, it'll point to the file in a directory for your application on the SDCard.

  • Thanks again.

    I've changed my 'success' code to that given below, but now the app crashes with a 'closed unexpectedly' android error. Any clues?


    var dir = Titanium.Filesystem.getExternalStorageDirectory();
    var f = Titanium.Filesystem.getFile(dir,'testimage.png');
    if(f.exists()) {
  • Hi! The solution is pretty simple:

  • are you getting the Android Camera Success Event to trigger 100% of the time?? For us in 1.6.2, 1.7x it triggers randomly….. :-(