java - Sending Email with attachment, sends a blank file -


i using code:

file mydir = new file(getapplicationcontext().getfilesdir().getabsolutepath()); try {                     log.i("csv testing ", "csv file creating");     filewriter fw = new filewriter(mydir + "/myfile.csv");     //                  // write data file                  //        log.i("csv testing ", "csv file created , data has been saved");     // process sending email csv file     file csvfile = new file(mydir,"myfile.csv");     // , sending email attachment } catch (ioexception e) {     log.i("exportcsv exception", e.tostring()); } 

but sends myfile.csv blank file. checked file explorer, myfile.csv not blank , contains right data. how can solve this?

my logcat messages

i/csv testing (16920): csv file creating i/csv testing (16920): csv file created , data has been saved i/csv file(16920): csv file exists i/send email testing(16920): email sending d/dalvikvm(16920): gc freed 2902 objects / 186576 bytes in 156ms i/activitymanager(   60): starting activity: intent { act=android.intent.action.chooser cmp=android/com.android.internal.app.chooseractivity (has extras) } w/activitymanager(   60): startactivity called non-activity context; forcing intent.flag_activity_new_task for: intent { act=android.intent.action.chooser flg=0x800000 cmp=android/com.android.internal.app.chooseractivity (has extras) } i/activitymanager(   60): displayed activity com.android.email/.activity.messagecompose: 1156 ms (total 2117 ms) w/inputmanagerservice(   60): starting input on non-focused client com.android.internal.view.iinputmethodclient$stub$proxy@43cf3050 (uid=10023 pid=207) w/iinputconnectionwrapper(  207): showstatusicon on inactive inputconnection 

if case....

ur path 2 file must missing somewhere, means path 2 file must incorrect....

and bcoz of this....

the statement file csvfile = new file(mydir,"myfile.csv");must creating new empty file on location..


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -