Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Export table to csv

 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i'm trying to export data i have in my sqlite database to csv. I don't know much about this so i searched code and tried to adapt to what i need but when i try to export it gives many errors.

When i click the button this runs:

Errors:

 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I managed to get it to work but it's exporting to the sd card but i wanted it to export my any directory in my internal storage. How can i do that??

 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are using Environment.getExternalStorageLocation() which naturally gets the location for the SD card. Here is the API for Environment: http://developer.android.com/reference/android/os/Environment.html. Are there any methods there that might give you a better location?
 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. Thanks for replying.

Which one is better to save the file on the downloads folder?? I saw the getStorageState(String filepath), but i dont know if its the correct one.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tell me, what does getStorageState() do?
 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From what i understood it return the state of the path i gave.
But actually i thougth better and i moved on, so i'm trying to send the file via e-mail because the user had to connect the phone to the pc and then transfer but there's a problem. When i click send it shows the file attached but when it sends it says "It wasnt possible to show the attached file".

When i check my e-mail, it's everything there but no file.

 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind, it's working. I had to add this:



And thank you Steve, really, you already helped me with all my questions
By the way, was i wrong with the getStorageState()??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic