[android-developers] Re: Update delete a directory and how to prevent this from happening?
I did use getExteranlStorageDirectory() method but i realize Android always mount it to /sdcard I am starting to think why not hardcode. I guess Google team will not change it (maybe the source /mnt/sdacrd but not the mount path), then again I guess it is a good practise and I will change it. :) thank for the advice. On Aug 4, 9:55 am, Mark Murphy wrote: > On Tue, Aug 3, 2010 at 9:52 PM, Mystique wrote: > > Thanks Mark, I have your books and use it here and there. > > Thanks! > > > I didnt use getExternalFilesDir(), I hardcore it directly. > > That is not a good idea, though I think you are confusing two methods. > Environment has a getExteranlStorageDirectory() method, which points > to the root of the external storage (e.g., /mnt/sdcard). I was > referring to the getExternalFilesDir() method on Context, new to > Android 2.2: > > http://developer.android.com/reference/android/content/Context.html#g...) > > > You mean a > > bug if I had getExternalFilesDir() in my code and it will delete the > > directory each time I call it? > > No, but a bug in getExternalFilesDir() will cause that directory to be > deleted on an upgrade, which I thought was your problem. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android Development Wiki:http://wiki.andmob.org -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Update delete a directory and how to prevent this from happening?
On Tue, Aug 3, 2010 at 9:52 PM, Mystique wrote: > Thanks Mark, I have your books and use it here and there. Thanks! > I didnt use getExternalFilesDir(), I hardcore it directly. That is not a good idea, though I think you are confusing two methods. Environment has a getExteranlStorageDirectory() method, which points to the root of the external storage (e.g., /mnt/sdcard). I was referring to the getExternalFilesDir() method on Context, new to Android 2.2: http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir(java.lang.String) > You mean a > bug if I had getExternalFilesDir() in my code and it will delete the > directory each time I call it? No, but a bug in getExternalFilesDir() will cause that directory to be deleted on an upgrade, which I thought was your problem. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Update delete a directory and how to prevent this from happening?
Thanks Mark, I have your books and use it here and there. I didnt use getExternalFilesDir(), I hardcore it directly. You mean a bug if I had getExternalFilesDir() in my code and it will delete the directory each time I call it? On Aug 4, 1:23 am, Mark Murphy wrote: > On Tue, Aug 3, 2010 at 12:43 PM, Mystique wrote: > > Yep, sounds logical and that is what I understood too. I have the > > directory in the SD and I believe it should not be deleted. > > Oh, wait. If you're using the new getExternalFilesDir(), what you are > experiencing is a bug. I'd consider holding off using that until > Gingerbread. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android Development Wiki:http://wiki.andmob.org -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Update delete a directory and how to prevent this from happening?
On Tue, Aug 3, 2010 at 12:43 PM, Mystique wrote: > Yep, sounds logical and that is what I understood too. I have the > directory in the SD and I believe it should not be deleted. Oh, wait. If you're using the new getExternalFilesDir(), what you are experiencing is a bug. I'd consider holding off using that until Gingerbread. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Update delete a directory and how to prevent this from happening?
Yep, sounds logical and that is what I understood too. I have the directory in the SD and I believe it should not be deleted. On Aug 4, 12:37 am, Mark Murphy wrote: > On Tue, Aug 3, 2010 at 12:35 PM, Mystique wrote: > > I have an app that create a directory and contact files in this. I do > > not want version update to delete this directory but I realize it has > > been deleted during the update. How do I prevent this from happening? > > Files located in getFilesDir() or on the SD card are not supposed to > be disturbed in an ordinary application upgrade. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android Development Wiki:http://wiki.andmob.org -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en