Aren't the methods in the Context class specific to the files within the application private file store? I've been trying to find a way to export data out of the applications space to the sdcard, the solution above by ggcespia is the only I've found that works. The methods I tried in the Context class where openFileOutput which again, saved the file within the directory data/data/com.myapp/?files?, not exactly sure about the last directory path, but regardless, it was not to the sdcard. Is there another method in the Context class that I'm missing that will specifically access the SD Card?
On Jan 5, 12:48 am, Jean-Baptiste Queru <[email protected]> wrote: > Note that you shouldn't hard-code the path to theSDcard. 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 -~----------~----~----~----~------~----~------~--~---

