6 messages in com.googlegroups.android-developersRe: FileNotFoundException in getFileS...| Subject: | Re: FileNotFoundException in getFileStreamPath("")![]() |
|---|---|
| From: | him2008 (barh...@gmail.com) |
| Date: | 01/30/2008 08:08:35 AM |
| List: | com.googlegroups.android-developers |
and why did eclipse catch exceptions b4 it do run the app on emulator ??? bcoz it'll always give me exceptions on folders & files which will be created on the run time, can i configure it not to do that ??
On Jan 30, 5:45 pm, him2008 <barh...@gmail.com> wrote:
thx, but i tried this b4: FileOutputStream fos = view.getContext().openFileOutput("test.txt", 0); also gives me FileNotFoundException !!!
On Jan 30, 7:45 am, Raj <raje...@gmail.com> wrote:
I have observed some issues with same kind of code. Especially, File constructor is not able to create new file. Try following:
FileOutputStream fos = this.openFileOutput("test.txt"); // this should be reference to contentresolver or activity OutputStreamWriter osw = new OutputStreamWriter(fos); // you need to replace it to write media file osw.write(...); osw.flush();
The file would be created under /data/data/<app package>/...
On Jan 30, 7:43 am, "Dan U." <dan....@gmail.com> wrote:
I'm not sure, but I think if you install your app to the emulator, the xx.xx folder is taken care of. Or maybe it could be that you have to access something in that folder (files, preferences, database) in order for it to get created.
The issue some of us are seeing is that it doesn't seem to automatically create the files subdirectory in your xx.xx folder.
On Jan 29, 6:05 pm, him2008 <barh...@gmail.com> wrote:
hello,
when i tried to build my code using eclipse(sdk ver: r37a) on windows, it gives me an error as follow: Unhandled exception type FileNotFoundException in getFileStreamPath(""), i'm new in android world, so i had red that this problem might be caused by </data/data/xx.xx/> folder absence, i'm using the emulator through eclipse so should i create this folder manually ? and where ?, this is a portion of my code:
public void onClick(View view) { .. .. Context d = view.getContext(); File f = new File(d.getFileStreamPath("").getAbsolutePath() +"mydata.amr"); f.mkdirs(); if(f.createNewFile()) d.showAlert("Info", "file created", "OK", false); String path = f.getAbsolutePath(); mr.setOutputFile(path); //MediaRecorder mr; ..
thx, with regards- Hide quoted text -
- Show quoted text -- Hide quoted text -




