java - (cannot find csv file created) Saving android sqlite database table into csv file which can be opened for viewing by human on a computer -


my objective write android sqlite database table csv file can read human on computer. want able open csv file on computer viewing of data.

i have researched on stackoverflow exporting database table csv , 1 of code use exporting sqlite database csv file in android. have tried several other code on stackoverflow. other code suggested on stackoverflow correct cant seem meet objective.

basically code similar link above.

my code can run without compilation error, meaning can run without error.

however, faced problem. either file not created onto computer viewing or created in android internal folder. tried search on window search button ".csv". not find file supposed created. need csv file database table data inside it.

i appreciate if can guide me on goes wrong or can locate actual csv file.i using android phone. following code of concern.

public void writetocsv(){         (int i=21; i<37; i++){// write each average table csv file             string tablenamestring = "test" + + "averssitable";             string csvfilename =tablenamestring+".csv";             file exportdir = new file(environment.getexternalstoragedirectory(), "");             if (!exportdir.exists())             {                 exportdir.mkdirs();             }              file file = new file(exportdir, csvfilename);             try             {                 file.createnewfile();                 csvwriter csvwrite = new csvwriter(new filewriter(file));                 sqlitedatabase rssidb = this.openorcreatedatabase("rssivalue", mode_private, null);                 cursor curcsv = rssidb.rawquery("select * "+tablenamestring,null);                 csvwrite.writenext(curcsv.getcolumnnames());                 while(curcsv.movetonext())                 {                     //which column want export                     string arrstr[] ={curcsv.getstring(0)};                     csvwrite.writenext(arrstr);                 }                 csvwrite.close();                 curcsv.close();                 rssidb.close();             }             catch(exception sqlex)             {                 log.e("mainactivity", sqlex.getmessage(), sqlex);             }         }     } 

if testing code on emulator file present in emulators sd card. can access eclipse->ddms->devices(select emulator)-file explorer->storage->sdcard.

click on file select option of pull file device. save open it.

if testing app on mobile search in mobiles sd card.

if file created find in above locations. if file not present in above location there must error in code


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -