I need to create the CSV file using my android application.So i uses Opencsv library to create CSV file.Below is my code
i called this method in my android class.below is my code for that.but it doesn't create any files in C drive.where is the error.I ran the application emulatoor.not the real phone?
Files created in an emulator will not be stored on the host's file system. There is a virtual disk used by the emulator for the internal storage and possible a second one used for the sd card. You will need to use apps in the emulator to find the file or use adp to explore the phone's file system.
Do you check if the media is available? Here is a code snippet from the link that Jeanne gave you.
Plus it will be helpful if you print the full file name.
In addition to checking state, note the paragraph starting with "Applications should not directly use this top-level directory,..." in the javadocs. That's effectively what you're doing, so you should fix that.
now its working fine.anyway i have one issue still.I need to write String array as a currently when i used below code it writes data as a row.how to change it to write as a column.
Have you read the API for the CSVWriter you are using?
Before you start coding, you should clearly define exactly what you want to do. Then you should read the API to see how it works. Then you should describe the steps (to yourself, in your native language, and on paper) needed to get what you want to a form the API expects. Then you should write code. This does mean a few things you need practice on:
1) Reading documentation
2) Thinking ahead
I am pretty sure if you do the simple thing and take just the code you have and print it out into a column instead of a row you will then have problems getting the rest of your data to match up to the row you need it to. So you need to understand the API, how it works, and what you need to do before you start coding.
Steve
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
a bit of art, as a gift, the permaculture playing cards