Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1041093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:18:21+00:00 2026-05-16T15:18:21+00:00

I want to create a file on the SD-Card and later save a CSV

  • 0

I want to create a file on the SD-Card and later save a CSV file in it.

From surfing around I noticed that there seem to be two ways about going about it:

http://developer.android.com/guide/topics/data/data-storage.html#filesExternal

If you’re using API Level 8 or
greater, use getExternalFilesDir() to
open a File that represents the
external storage directory where you
should save your files. This method
takes a type parameter that specifies
the type of subdirectory you want,
such as DIRECTORY_MUSIC and
DIRECTORY_RINGTONES (pass null to
receive the root of your application’s
file directory).

If you’re using API Level 7 or lower,
use getExternalStorageDirectory(), to
open a File representing the root of
the external storage. You should then
write your data in the following
directory:

/Android/data//files/

And http://www.anddev.org/working_with_files-t115.html :

FileWriter f = new FileWriter("/sdcard/download/possible.txt");

What way should I use? If the first, how do I write my application to be compatible with both API level <=7 and >=8? Is there some good tutorial for doing it the first way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:18:22+00:00Added an answer on May 16, 2026 at 3:18 pm

    Well if you need compatibility with API level 7 and lower, use getExternalStorageDirectory() method. Also note that staring from API level 4 you have to request permission to write onto SD card:

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a file in sd card and put my image from
I want to create log file for my flex application. That is the file
I want to create a PNG file from a System.Drawing.Bitmap with the colours defined
I want to create one application which send email with attachment(select file from SD
I want to create a file t save some information for my app next
I want to create a file that is in specific directory. For example: C:\x\y\z\aTextFile.txt
I want to create a file with a block of code in it and
I want to create a file in the current directory (where the executable is
Possible Duplicate: PHP create a file without fopen I want to create a file
In Linux environment, I want to create a file and write text into it:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.