Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - File not found while trying to save image...

File not found while trying to save image...

All your problems with Audio, Video and Images.

File not found while trying to save image...

Postby ninjasenses » Tue Jul 06, 2010 8:04 am

I am trying to save a picture after it has been taken, but I keep getting an exception saying File not Found...I dont know what Im doing wrong at all, everything seems fine to me. Heres a code snippet:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.         public static boolean StoreByteImage(Context mContext, byte[] imageData,
  2.                         int quality, String expName) {
  3.                
  4.                 File root = Environment.getExternalStorageDirectory();
  5.                 File sdImageMainDirectory = new File(root,"/giddyup");
  6.         //File sdImageMainDirectory = new File("/mysdcard/myImages");
  7.         //sdImageMainDirectory.mkdirs();
  8.                 FileOutputStream fileOutputStream = null;
  9.                 try {
  10.  
  11.                         BitmapFactory.Options options=new BitmapFactory.Options();
  12.                         options.inSampleSize = 5;
  13.                        
  14.                         Bitmap myImage = BitmapFactory.decodeByteArray(imageData, 0,
  15.                                         imageData.length,options);
  16.  
  17.                         fileOutputStream = new FileOutputStream(
  18.                                         sdImageMainDirectory.toString() +"/" + expName + ".jpg");
  19.  
  20.                         BufferedOutputStream bos = new BufferedOutputStream(
  21.                                         fileOutputStream);
  22.  
  23.                         myImage.compress(CompressFormat.JPEG, quality, bos);
  24.  
  25.                         bos.flush();
  26.                         bos.close();
  27.  
  28.                 } catch (FileNotFoundException e) {
  29.                         // TODO Auto-generated catch block
  30.                         e.printStackTrace();
  31.                 } catch (IOException e) {
  32.                         // TODO Auto-generated catch block
  33.                         e.printStackTrace();
  34.                 }
  35.  
  36.                 return true;
  37.         }
  38.  
Parsed in 0.016 seconds, using GeSHi 1.0.8.4


it is failing on this line: fileOutputStream = new FileOutputStream(
sdImageMainDirectory.toString() +"/" + expName + ".jpg");

any help would be greatly appreciated
ninjasenses
Junior Developer
Junior Developer
 
Posts: 14
Joined: Tue Jul 06, 2010 8:00 am

Top

Re: File not found while trying to save image...

Postby anarche » Tue Jul 06, 2010 8:07 am

Can you post the logcat please?
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: File not found while trying to save image...

Postby ninjasenses » Tue Jul 06, 2010 8:42 am

07-06 07:54:22.702: INFO/ActivityManager(52): Starting activity: Intent { cmp=com.cutter.giddyup/.CameraView }
07-06 07:54:22.772: ERROR/CameraTest(338): onCreate
07-06 07:54:22.772: ERROR/CameraTest(338): onResume
07-06 07:54:22.912: ERROR/CameraTest(338): surfaceCreated
07-06 07:54:22.912: DEBUG/CameraService(31): CameraService::connect E (pid 338, client 0xdb10)
07-06 07:54:22.912: DEBUG/CameraService(31): Client::Client E (pid 338)
07-06 07:54:22.912: DEBUG/CameraHardwareStub(31): initHeapLocked: preview size=176x144
07-06 07:54:22.932: ERROR/MediaPlayerService(31): error: -2
07-06 07:54:22.932: ERROR/MediaPlayer(31): Unable to to create media player
07-06 07:54:22.932: ERROR/CameraService(31): Failed to load CameraService sounds.
07-06 07:54:22.952: ERROR/MediaPlayerService(31): error: -2
07-06 07:54:22.952: ERROR/MediaPlayer(31): Unable to to create media player
07-06 07:54:22.952: ERROR/CameraService(31): Failed to load CameraService sounds.
07-06 07:54:22.952: DEBUG/CameraService(31): Client::Client X (pid 338)
07-06 07:54:22.952: DEBUG/CameraService(31): CameraService::connect X
07-06 07:54:22.972: ERROR/CameraTest(338): surfaceChanged
07-06 07:54:22.972: DEBUG/CameraService(31): getParameters(picture-format=jpeg;picture-size=213x350;preview-format=yuv422sp;preview-frame-rate=15;preview-size=176x144)
07-06 07:54:22.992: DEBUG/CameraService(31): setParameters(preview-size=320x480;preview-format=yuv422sp;picture-size=213x350;picture-format=jpeg;preview-frame-rate=15)
07-06 07:54:22.992: DEBUG/CameraHardwareStub(31): initHeapLocked: preview size=320x480
07-06 07:54:23.012: DEBUG/CameraService(31): setPreviewDisplay(0xf298) (pid 338)
07-06 07:54:23.022: DEBUG/CameraService(31): startPreview (pid 338)
07-06 07:54:23.022: DEBUG/CameraService(31): startCameraMode(0) (pid 338)
07-06 07:54:23.022: DEBUG/CameraService(31): startPreviewMode (pid 338)
07-06 07:54:23.252: INFO/ActivityManager(52): Displayed activity com.cutter.giddyup/.CameraView: 522 ms (total 522 ms)
07-06 07:54:25.192: DEBUG/CameraService(31): takePicture (pid 338)
07-06 07:54:25.342: DEBUG/Camera-JNI(338): dataCallback(256, 0x1314d8)
07-06 07:54:25.382: WARN/System.err(338): java.io.FileNotFoundException: /sdcard/giddyup/ImageName.jpg
07-06 07:54:25.392: WARN/System.err(338): at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:244)
07-06 07:54:25.392: WARN/System.err(338): at java.io.FileOutputStream.<init>(FileOutputStream.java:97)
07-06 07:54:25.392: WARN/System.err(338): at java.io.FileOutputStream.<init>(FileOutputStream.java:168)
07-06 07:54:25.402: WARN/System.err(338): at java.io.FileOutputStream.<init>(FileOutputStream.java:147)
07-06 07:54:25.402: WARN/System.err(338): at com.cutter.giddyup.CameraView.StoreByteImage(CameraView.java:101)
07-06 07:54:25.412: WARN/System.err(338): at com.cutter.giddyup.CameraView$1.onPictureTaken(CameraView.java:74)
07-06 07:54:25.412: WARN/System.err(338): at android.hardware.Camera$EventHandler.handleMessage(Camera.java:315)
07-06 07:54:25.412: WARN/System.err(338): at android.os.Handler.dispatchMessage(Handler.java:99)
07-06 07:54:25.432: WARN/System.err(338): at android.os.Looper.loop(Looper.java:123)
07-06 07:54:25.432: WARN/System.err(338): at android.app.ActivityThread.main(ActivityThread.java:4363)
07-06 07:54:25.432: WARN/System.err(338): at java.lang.reflect.Method.invokeNative(Native Method)
07-06 07:54:25.442: WARN/System.err(338): at java.lang.reflect.Method.invoke(Method.java:521)
07-06 07:54:25.442: WARN/System.err(338): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
07-06 07:54:25.452: WARN/System.err(338): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
07-06 07:54:25.452: WARN/System.err(338): at dalvik.system.NativeStart.main(Native Method)
07-06 07:54:25.462: DEBUG/CameraService(31): startPreview (pid 338)
07-06 07:54:25.462: DEBUG/CameraService(31): startCameraMode(0) (pid 338)
07-06 07:54:25.462: DEBUG/CameraService(31): startPreviewMode (pid 338)
07-06 07:54:25.712: ERROR/CameraTest(338): surfaceDestroyed
07-06 07:54:25.712: DEBUG/CameraService(31): stopPreview (pid 338)
07-06 07:54:25.882: DEBUG/CameraService(31): stopPreview(), hardware stopped OK
07-06 07:54:25.902: DEBUG/Camera-JNI(338): release camera
07-06 07:54:25.902: DEBUG/CameraService(31): Client::disconnect() E (pid 338 client 0xdb10)
07-06 07:54:25.902: DEBUG/CameraService(31): hardware teardown
07-06 07:54:25.912: DEBUG/CameraService(31): removeClient (pid 338) done
07-06 07:54:25.932: DEBUG/CameraService(31): Client::disconnect() X (pid 338)
07-06 07:54:25.962: ERROR/CameraTest(338): onStop
07-06 07:54:25.992: DEBUG/CameraService(31): Client::~Client E (pid 31, client 0xdb10)
07-06 07:54:26.032: DEBUG/CameraService(31): Client::disconnect() E (pid 31 client 0xdb10)
07-06 07:54:26.032: DEBUG/CameraService(31): Client::~Client X (pid 31)

PS: I did not know about logcat until I read the post in your sig...Thanks!! :D
ninjasenses
Junior Developer
Junior Developer
 
Posts: 14
Joined: Tue Jul 06, 2010 8:00 am

Re: File not found while trying to save image...

Postby anarche » Tue Jul 06, 2010 11:09 am

try popping in a

if (!sdImageMainDirectory.isFile() { sdImageMainDirectory.createNewFile(); }

p.s. you sir, have just made my day! :D you're welcome!
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: File not found while trying to save image...

Postby ninjasenses » Tue Jul 06, 2010 10:07 pm

anarche wrote:try popping in a

if (!sdImageMainDirectory.isFile() { sdImageMainDirectory.createNewFile(); }

p.s. you sir, have just made my day! :D you're welcome!


Thanks that did the trick...the logcat has been a huge benifit to me, im so glad i found it.
ninjasenses
Junior Developer
Junior Developer
 
Posts: 14
Joined: Tue Jul 06, 2010 8:00 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 5 guests