I changed my code to :
FileOutputStream fos = new FileOutputStream(filepath + "/" +
filename);

This allowed me to save the image, I loaded the device using DDMS and
noticed the image had been saved. I've tried using the
MediaScannerConnection to refresh the sd card so that I can view the
image, I need some help with that..

On Apr 17, 2:17 pm, jwesonga <crazylun...@gmail.com> wrote:
> I'm using Android SDK-1.0_rc2 on windows, I've emulated the sd card
> and created on my D:\ drive as sdcard1.iso. My code for saving to the
> SD card is as follows:
>
> try
>              {
>                  Log.e("filename",filename);
>                  String filepath=Environment.getExternalStorageDirectory
> ().getAbsolutePath();
>                  Log.e("FilePath",filepath);
>                  FileOutputStream fos = openFileOutput(filepath +
> filename, MODE_APPEND);
>                  BufferedOutputStream bos = new BufferedOutputStream
> (fos);
>                  b.compress(CompressFormat.JPEG, 100, fos);
>                  bos.flush();
>                  bos.close();
>
>              }
> When I view the Logcat I see the following error:
> java.lang.IllegalArgumentException: File /sdcardobama.jpg contains a
> path separator
>
> So I changed the code to:
> FileOutputStream fos = openFileOutput(filepath + "/" + filename,
> MODE_APPEND);
>
> The error is still occuring, so I tried to push the image using the
> command:
>
> adb push obama.jpg /sdcard/obama.jpg
>
> I noticed 0 bytes are being pushed, any idea where I'm going wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to