Actually, use: File pathDir = Environment.getExternalStorageDirectory();
That is, don't use toString() unless and until you actually need it. A File object is more useful. Don't perform string operations to construct file paths. For example, write File logDir = new File(pathDir, "logg"); logDir.mkdirs(); File logFile = new File(logDir, generateLogDirName()); OutputStream logStream = new FileOutputStream(logfile); BufferedWriter logWriter = new BufferedWriter(new OutputStreamWriter(logStream, "UTF-8")); No toString() method needed -- wanted! On Jan 14, 6:58 am, Kumar Bibek <coomar....@gmail.com> wrote: > The abolute path to the external storage might be different. The correct way > to access the path is > > String fPathDir = > Environment. > getExternalStorageDirectory().toString(); > > Don't care what it returns, just use this. > > Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com > > > > > > > > On Fri, Jan 14, 2011 at 1:59 PM, Nroblex <aselb...@gmail.com> wrote: > > Hello Gurus! > > > I am very new to java and Android development. So this is perhaps a > > very simple question for you. > > > I am developing on a HTC Desire and I am trying to create a loggdir on > > my storage card. > > if I use the suggested function getExternalStorageDirectory like this > > "String fPathDir = > > Environment.getExternalStorageDirectory().toString();" > > this returns /mnt/SdCard and not /SdCard. > > > if I try to create a directory on in "/mnt/SdCard/logg" > > with mkdirs() it throws an exception, but if I create a directory in > > > "/SdCard/logg" mkdirs() is successfull > > > What am I missing here? > > > Thanks in advance > > //Nroblex > > > -- > > 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<android-developers%2Bunsubs > > cr...@googlegroups.com> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en -- 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