• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Export table to csv

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??

 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tell me, what does getStorageState() do?
 
Ruben Matt
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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()??
 
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic