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 4267828
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:57:10+00:00 2026-05-21T06:57:10+00:00

I can not get my application to write to the sdcard. I have tried

  • 0

I can not get my application to write to the sdcard. I have tried several different ways and none of them are working. I have seen several posts here on SO that are having the same problem and the problem is not resolved. Can someone please take a look at my code and see what is wrong?

I have <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> in my manifest.

                       String inFileName = "/data/data/cpe495.smartapp/files/test.csv"; //TODO Use folder/filename
                          File inFile = new File(inFileName);
                          try{
                          FileInputStream fis = new FileInputStream(inFile);

                          String outFileName = Environment.getExternalStorageDirectory()+"/test.csv"; //TODO Use output filename
                          OutputStream output = new FileOutputStream(outFileName);

                          byte[] buffer = new byte[1024];
                          int length;
                          while ((length = fis.read(buffer))>0)
                            output.write(buffer, 0, length);

                          output.flush();
                          output.close();
                          fis.close();
                          } catch (Exception e) {
                              e.printStackTrace();
                          }   

04-06 00:17:14.961: WARN/System.err(279): java.io.FileNotFoundException: /mnt/sdcard/test.csv (Permission denied)
04-06 00:17:15.000: WARN/System.err(279):     at org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
04-06 00:17:15.000: WARN/System.err(279):     at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:152)
04-06 00:17:15.012: WARN/System.err(279):     at java.io.FileOutputStream.<init>(FileOutputStream.java:97)
04-06 00:17:15.022: WARN/System.err(279):     at java.io.FileOutputStream.<init>(FileOutputStream.java:168)
04-06 00:17:15.032: WARN/System.err(279):     at java.io.FileOutputStream.<init>(FileOutputStream.java:147)
04-06 00:17:15.032: WARN/System.err(279):     at cpe495.smartapp.SmartApp$8.onClick(SmartApp.java:165)
04-06 00:17:15.041: WARN/System.err(279):     at android.view.View.performClick(View.java:2408)
04-06 00:17:15.051: WARN/System.err(279):     at android.view.View$PerformClick.run(View.java:8816)
04-06 00:17:15.062: WARN/System.err(279):     at android.os.Handler.handleCallback(Handler.java:587)
04-06 00:17:15.062: WARN/System.err(279):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-06 00:17:15.072: WARN/System.err(279):     at android.os.Looper.loop(Looper.java:123)
04-06 00:17:15.072: WARN/System.err(279):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-06 00:17:15.081: WARN/System.err(279):     at java.lang.reflect.Method.invokeNative(Native Method)
04-06 00:17:15.091: WARN/System.err(279):     at java.lang.reflect.Method.invoke(Method.java:521)
04-06 00:17:15.091: WARN/System.err(279):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-06 00:17:15.101: WARN/System.err(279):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-06 00:17:15.101: WARN/System.err(279):     at dalvik.system.NativeStart.main(Native Method)
  • 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-21T06:57:10+00:00Added an answer on May 21, 2026 at 6:57 am

    The solution to this problem was to add an sdcard to the emulator. After adding the sd card to the emulator everything worked fine.

    Here is one way to do this.

    The other way, is to pull up your list of devices in eclipse, then create a new virtual device. During the setup for the virtual device a window with options should come up that asks if you want an sdcard and what size you want it. This is how i did it, and i was unable to find a tutorial for it online. I stumbled on this on accident when looking around for options.

    Thanks in advance!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Have been fiddling with this for hours. I can not get my text
I can not make TextMate2 to get my PYTHONPATH. Things I tried: Put the
I've seen somewhere but can not remember. How to get a SQL string from
I can not get to make this comparison in this simple code error ..
I can not get logs from some customers, can I use Google Urchin in
I can not get environment at custom target shell. CMakeList.txt set( ENV{TEST_VAR} Hello )
I simply can not get Visual Studio 2005 to find the System.Configuration.ConfigurationManager class. Here
In silverlight, I can not get INotifyPropertyChanged to work like I want it to
I am sending an error response to my jQuery. However, I can not get
HEllo , i can not find any way to get horizontal or/and vertical resolution

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.