title: Android - Read Only File System IOException
body: <p>I am trying to write to a simple text file on the Android system. This is my code:</p>
  
  <pre><code>public void writeClassName() throws IOException{
      String FILENAME = "classNames";
      EditText editText = (EditText) findViewById(R.id.className);
      String className = editText.getText().toString();
  
      File logFile = new File("classNames.txt");
         if (!logFile.exists())
         {
            try
            {
               logFile.createNewFile();
            } 
            catch (IOException e)
            {
               // TODO Auto-generated catch block
               e.printStackTrace();
            }
         }
         try
         {
            //BufferedWriter for performance, true to set append to file flag
            BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true)); 
            buf.append(className);
            buf.newLine();
            buf.close();
         }
         catch (IOException e)
         {
            // TODO Auto-generated catch block
            e.printStackTrace();
         }
  </code></pre>
  
  <p>However, this code produces a "java.io.IOException: open failed: EROFS (Read-only file system)" error. I have tried adding permissions to my Manifest file as follows with no success:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="hellolistview.com"
  android:versionCode="1"
  android:versionName="1.0" &gt;
  
  &lt;uses-sdk android:minSdkVersion="15" /&gt;
  
  &lt;application
      android:icon="@drawable/ic_launcher"
      android:label="@string/app_name" &gt;
      &lt;activity
          android:name=".ClassView"
          android:label="@string/app_name" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
       &lt;activity 
          android:name=".AddNewClassView" 
          /&gt;
  
  &lt;/application&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  </code></pre>
  
  <p>
  Anyone have any idea what the problem is?</p>