Wednesday, June 15, 2011

[android-developers] Re: Can't write to sdcard

You are indeed correct:) A major oversight on my part.
Ab

On Jun 15, 1:26 pm, Kostya Vasilyev <kmans...@gmail.com> wrote:
> The colon in the filename (between 19 and 37) is likely invalid for FAT32,
> even under a Linux kernel, for historical reasons.
>
> It would be more obvious if Android used paths like "C:\Android\system" and
> "D:\sdcard"
>
> :)
> -- Kostya
> 2011/6/15 Ab Caballero <a...@mac.com>
>
>
>
> >  File file = new File(sdDir + "/" + currentTripName + ".kml");
> > yields:
> >  06-15 13:25:29.209: WARN/System.err(13412):
> > java.io.FileNotFoundException: /mnt/sdcard/2011Jun1419:37.kml (Invalid
> > argument).
>
> > I also checked the file permissions, which are: lwrxwrxwrx root root.
> > After that i remounted the sdcard in adb, but results are still the
> > same.
>
> > Any other thoughts?
>
> > On Jun 13, 8:53 am, Mike <j.m.roya...@gmail.com> wrote:
> > > check the file name and be sure it's ok.
>
> > > Running a modified version of your code on a 2.3.3 emulator
>
> > >                 File sdDir = Environment.getExternalStorageDirectory();
> > >                 sdDir.mkdirs();
> > >                 String currentTripName = "testtrip";
> > >                 File file = new File(sdDir + currentTripName + ".kml");
> > >                 FileWriter sdWriter;
> > >                 try {
> > >                         sdWriter = new FileWriter(file, false);
> > >                         String fileContents = "This is a test trip file";
> > >                         sdWriter.write(fileContents);
> > >                         sdWriter.close();
>
> > >                 } catch (IOException e) {
> > >                         // TODO Auto-generated catch block
> > >                         e.printStackTrace();
> > >                 }
>
> > > yeilds this error
>
> > > 06-13 12:45:03.358: WARN/System.err(1663):
> > > java.io.FileNotFoundException: /mnt/sdcardtesttrip.kml (Read-only file
> > > system)
>
> > > maybe try
>
> > > File file = new File(sdDir + "/" + currentTripName + ".kml");
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscribe@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment