So I am fairly new to android programming. I have a database and I want to be able to take the information from the database stored on the android device, store it in a .csv file, attach it to an email, and send it to the receiver. This is however my first time working with a .csv file and I want to make sure I am doing it right.
I looked at this page: Convert database .db file into .csv
But I am not sure the correct way to implement this using my current code, or even if this is what I am looking for.
I also tried using a bit of: OpenCSV
and noticed a section about dumping SQL into a .csv, would this be the best way to implement it? Any and all help and advice would be appreciated, thank you for your time!
If you are not too commited to attaching a csv file, it is really easy to just dump a big string into the body of an email, and send it to someone. You don’t have the issue of writing a local file and attaching it.
When sending an email you can just add:
emailIntent.putExtra(Intent.EXTRA_TEXT, emailBody);
where emailBody is a big string that has your data in it.
At least this might be an interim solution?
Here is a little code that can send an email with a big string of text in it.