You don't.  Use Context to create files and get the paths to your app's
directories.

On Wed, Apr 29, 2009 at 6:47 AM, prajapatmanoj <[email protected]>wrote:

>
> Hi
>
> I am new to Android and creating my first application.
>
> I want to create a file in the current directory. Basically I have a
> file bundled with aplication package as raw resource. I want to make a
> copy of this file in the current file. The reason to create copy in
> current directory is that I want my file reading code in native java,
> portable code.
>
> To write a file in current directory I am doing following:
>
>        String currentdir = System.getProperty("user.dir");
>        String destination = currentdir + "test.txt";
>        File fileCon = new File(destination);
>        if( ! fileCon.exists() ){
>                fileCon.createNewFile();
>            }
>
> But on createNewFile statement it is throwing IOException with
> following message
>
> java.io.IOException: Parent directory of file is not writable:
> temp.txt
>
> So my query is how can I create a file on current directory? The
> location current directory is important here as I do not want to make
> use of device specific hardcoded path or any Android API while reading
> the file. This is so I want my file reading code portable.
>
> Thanks
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

Reply via email to