you first check you have write permission to /sdcard,use adb to
connect G1,and then use command like these:
adb shell
touch /sdcard/test.txt

On 4月2日, 下午12时50分, ambrosehua <huang.p...@zte.com.cn> wrote:
> Are you sure that you have  write permission to /sdcard ( sdcard
> mounted with RW and the directory /sdcard i writable) ?
> I suggest you  run another app to  store some information  in /sdcard
> for a test
>
> On 4月2日, 下午12时23分, BJP <bjpcalt...@gmail.com> wrote:
>
>
>
> > Thanks Mark, but I'm debugging the application on a T-Mobile G1 with
> > installed SD card (real hardware) ~ no emulator, just the real thing.
> > Is there a permission needed that I'm not recognizing?  Or, is there a
> > special exclusive way to deal with files on the SD card?  Any help or
> > pointing in the right direction would be very helpful!
>
> > Thanks,
> > Ben
>
> > On Apr 1, 10:36 am, Mark Murphy <mmur...@commonsware.com> wrote:
>
> > > BJP wrote:
> > > > I would like to write a file to the SD card from my application, but
> > > > the following code throws an IOException when debugged on a T-Mobile
> > > > G1:
>
> > > > String p = Environment.getExternalStorageDirectory() + "/log.txt";
> > > > File recfile = new File(p);
> > > > recfile.createNewFile();
>
> > > > The last line throws an IOException with detailMessage = "Cannot
> > > > create: /sdcard/log.txt".  The MOUNT_UNMOUNT_FILESYSTEMS permission is
> > > > set in the manifest.  And yes, I really do want to write to the SD
> > > > card; I don't want to use the logging features Android includes for
> > > > this particular application.  The Android documentation does not seem
> > > > to give any specifics on how one might write files to removable
> > > > storage in "Data Storage" under "Framework Topics".  What am I doing
> > > > wrong, or where can I read more about this topic?
>
> > > If you are running this on the emulator, do you have an SD card image
> > > set up? The emulator does not have SD card storage by default -- you
> > > need to use mksdcard to create an image and then tell the emulator to
> > > use that image via a command-line switch at startup.
>
> > > --
> > > Mark Murphy (a Commons 
> > > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > > Warescription: Three Android Books, Plus Updates, $35/Year- 隐藏被引用文字 -
>
> - 显示引用的文字 -

--~--~---------~--~----~------------~-------~--~----~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to