file - Parent Directory is not Writable Error Android Emulator -


getting "parent directory of file not writable" when trying create temp file. using eclipse , emulator. using permission in manifest:

<uses-permission android:name="android.permission.write_external_storage"/> 

here code:

@suppresswarnings("static-access") public void sendemail() {     calendar today = new gregoriancalendar();     log.d(tag, "path:" + environment             .getexternalstoragedirectory().getabsolutepath()             + "/gpstracking/" + maketextdate(today) + ".csv");     file tempfile = null;     try {           tempfile.createtempfile(maketextdate(today), ".csv");         filewriter out = formatemail(tempfile);     }     catch (ioexception e) {          // error         log.d(tag, "create temp file:" + e.tostring());     }      try {         intent emailintent = new intent(android.content.intent.action_send);          emailintent.putextra(android.content.intent.extra_subject,                 "trip report");         emailintent                 .putextra(intent.extra_text, "here trips report");          emailintent.putextra(intent.extra_stream, uri.fromfile(tempfile));         emailintent.settype("plain/text");         startactivity(intent.createchooser(emailintent, "send email..."));     } catch (exception e) {         e.printstacktrace();     } } 

you're trying create file in root directory of storage, not sd-card

tempfile.createtempfile(maketextdate(today), ".csv"); 

create file writing log full path external storage.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -