Well, if you just want to store files in the applications "files" dir, then you'd just need to store "test.txt" and use that with openFileInput. You don't need to have the "files" directory stored. In fact, I wouldn't be surprised if that directory name were to change in a future sdk. It all depends on what the Android team decides to do.
On Apr 8, 9:29 pm, Kevin Tan <[EMAIL PROTECTED]> wrote: > For this application in the package > com.organization.android.app.myapplication, how do i setup a relative > path for the test.txt i created with openFileOutput on android? is it > "//files/test.txt"? > > On Apr 8, 6:18 pm, "Dan U." <[EMAIL PROTECTED]> wrote: > > > I think you should use relative addressing. As I recall, the files > > location for your application is not set in stone. It may change. > > > A content provider is a way to give access to your data from other > > applications or let your data access other applications data. I > > suppose since the MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE flags > > lets another app access your file, you wouldn't have to use a content > > provider, but I suppose it would be discouraged to do it this way. > > > I'm not sure if there is an easy way to change the flag. I haven't > > seen one. I don't think I'd manipulate the file data. I think maybe > > just opening the file for output with a different flag would do it. > > Either that or maybe you'd have to get the file contents, then delete > > and re-create it with the new flag. > > > On Apr 8, 2:16 pm, Kevin Tan <[EMAIL PROTECTED]> wrote: > > > > Thank you for your reply. I have a few more questions.> 1. Should be > > > /data/data/com.organization.android.app.myapplication/ > > > > files/test.txt > > > > When I am implementing the contentprovider for myapplication, the path > > > of a file in the database will be this? Or should I use relative > > > addressing? > > > > > 3. There isn't anything stopping another app from reading it. > > > > So the content provider is just a convenient way to access data from > > > our application? Also, I have not noticed a function to change the > > > mode of an existing file. Is there a way to change the mode? Or do I > > > have to actually manipulate bytes in the file to do that? > > > > On Apr 8, 3:32 pm, "Dan U." <[EMAIL PROTECTED]> wrote: > > > > > 1. Should be /data/data/com.organization.android.app.myapplication/ > > > > files/test.txt > > > > > 2. I think it is possible to use normal file i/o code (by normal, I > > > > mean not using openFileOutput) to do this. > > > > > 3. There isn't anything stopping another app from reading it. > > > > > 4. I found > > > > this:http://blogs.sun.com/manveen/entry/blob_vs_file_system_storage > > > > which might give you an idea, although I don't really agree with all > > > > of it. For example: > > > > > # The whole point of storing data in a SQL database, is to put some > > > > kind of ordering and structure on your data, as well as being able to > > > > search on these data. But how do you search in the > > > > # binary data of a picture? > > > > > That's what other columns in the table are for. Just because a column > > > > is there doesn't mean you need to search with it. > > > > > On Apr 8, 12:04 pm, Kevin Tan <[EMAIL PROTECTED]> wrote: > > > > > > hi, > > > > > > I have been reading the android file storage and content provider > > > > > documentations and have few questions that was unanswered. I did a few > > > > > searches alternating around the words ' android file storage methods' > > > > > and can the only result that i find useful is the documentation that i > > > > > have been reading which is > > > > > this.http://code.google.com/android/devel/data.html > > > > > > Here are my questions, > > > > > > lets say that my application package is > > > > > com.organization.android.app.myapplication > > > > > > 1) Where is the file stored in android by default if I am to create a > > > > > new file named test.txt with this openFileOutput("test.txt", > > > > > MODE_WORLD_READABLE); > > > > > > 2) The documentation of the openFileOutput says that the name > > > > > parameter cannot contain path separators, so does that mean that I > > > > > cannot specify where to place my file in the application? Or is there > > > > > another way to specify where i want my files? > > > > > > 3) If i set the file mode to MODE_WORLD_READABLE, what is stopping an > > > > > outside application from using the path to read it? > > > > > > 4) sqlite3 supports byte data types (called blob) but the > > > > > contentprovider tutotial recommends that we store a string that > > > > > represents the path of the file instead, why is that? > > > > > > Any answer or suggestion is greatly appreciated > > > > > > Kevin- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

