Friday, November 6, 2009

[android-developers] Re: Unable to write text file to sdcard on physical G1 device

Hi,

Have you checked the file after creating and writing in SD card?
I tried with Java application and JNI (C code) application. In both
cases it is creating a file but the file content size is 0 bytes after
wiriting some data.
But the APIs open, write and read are successed.

Anyone having solution for this problem.

Thanks in advance.

-suresh.

On Oct 28, 4:45 am, androiduser mobile <androiduser.mob...@gmail.com>
wrote:
> We resolved the issue, my project is dependent on another project and
> after keeping the WRITE_EXTERNAL_STORAGE permission in both the
> projects manifest files solved the issue.
>
> Thank you all for helping.
> Android user.
>
> On Oct 15, 12:13 pm, androiduser mobile <androiduser.mob...@gmail.com>
> wrote:
>
> > Hi Mark,
>
> > we did try these but no luck. We tried with sameSDcardwhat I am
> > using. No formatting issue.
>
> > Thanks,
> > Android user
>
> > On Oct 15, 10:49 am, Mark Murphy <mmur...@commonsware.com> wrote:
>
> > >androiduser mobilewrote:
> > > >         File directory = new File
> > > > (Environment.getExternalStorageDirectory().getPath()+"/downloads");
>
> > > Creating paths via concatenation is bad form and prone to error (e.g.,
> > > duplicate slashes). Use:
>
> > > new File(Environment.getExternalStorageDirectory(), "downloads");
>
> > > >         File file = new File(directory.getPath()+"/"+filename);
>
> > > See above.
>
> > > >         if (!file.exists() && directory.exists()){
> > > >            try {
> > > >                file.createNewFile();
> > > >            } catch (IOException e) {
> > > >                    Log.d(TAG,"File creation failed for " + file);
> > > >            }
> > > >         }
>
> > > Is theSDcardon the target device formatted FAT32, or something else?
>
> > > --
> > > Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > > _Android Programming Tutorials_ Version 1.0 In Print!- Hide quoted text -
>
> > - Show quoted text -

--
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