On Mon, Jun 21, 2010 at 8:27 AM, changdeo <changdeojad...@gmail.com> wrote: > I want to create a log file for my application in application space, > so that user can review what went wrong. But We can not access files > created in application space(access in the sense that we can not pull > it to desktop , or can not view on phone using some editor). Can > anybody please help me to create a file on application space and tell > a way to read it.
If you want people to manipulate the file independently of your application, put it on the SD card. > I am doing this > > String fileName = Environment.getExternalStorageDirectory()+"/ > WFLog.txt"; > FileOutputStream fout = new FileOutputStream(fileName); If you have the WRITE_EXTERNAL_STORAGE permission, this should work to write a file to the SD card. > I have also tried using > openOutputStream with permission WORLD_READABLE. This will not help much, as no apps will readily be able to browse to that file. > Alternative I thought was to create log file on sdcard but I can not > delete it when application gets uninstalled. On Android 2.2, you can use getExternalFilesDir() (available on Activity and other subclasses of Context) to get access to a directory on the SD card that will be removed automatically when the application is uninstalled. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en