Note that you shouldn't hard-code the path to the SD card. There's an API in the Context class (if I remember correctly) that let's you query it.
JBQ On 1/4/09, ggcespia <[email protected]> wrote: > > problem solved. package B had a typo in the file name. works fine > now. > > On Jan 3, 9:02 pm, ggcespia <[email protected]> wrote: >> I'm trying to create file at /sdcard/foobar.tmp from one package that >> needs to be readable by another package. This works fine on the >> emulator. However, on the G1, if I create the file in package A, then >> try to read it in package B, the request fails - even tho both >> packages are signed by the same certificate. I create the file from >> Package A with: >> >> File myFile = new File("/sdcard/foobar.tmp"); >> myFile.createNewFile(); >> >> FileOutputStream fOut = new FileOutputStream(myFile); >> String sMofi = "some text"; >> fOut.write(sMofi.getBytes()); >> fOut.flush(); >> fOut.close(); >> >> To see if the file exists from Package B, I use: >> File myFile = new File("/sdcard/foobar.tmp"); >> if (myFile.isFile()) >> { >> bTempFile = true; >> } >> >> myFile.isFile() - returns false - I can see the file using ddms with >> permissions: ----rw-rw- >> >> Why does isFile fail? I cannot use Context.openFileOutput() because >> that creates a file relative to package A - and B doesn't know where >> package A is... >> >> Is there a way to create a file at /sdcard/foobar.tmp and have any >> package be able to read or write it? > > > -- Jean-Baptiste M. "JBQ" Queru Android Engineer, Google. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

