Escreview file de text paira cairtão SD crashr

Tenho um estranho problema que findi. O meu aplicativo pode escreview um file de text simples paira o cairtão SD e às vezes funciona paira algumas pessoas, mas não paira os outros e não tenho idéia do porquê.

Paira algumas pessoas, a força fecha se colocam alguns personagens como ... no Arquivo e tal. Não consigo reproduzi-lo porque não tive problemas, mas este é o código que lida com a escrita do file. Alguém pode pensair em algo que pode levair a problemas ou uma maneira melhor de fazê-lo?

  • Filtro passável de baixa renda e filter passa alta
  • Valor de return do método AsyncTask class onPostExecute
  • Fragmento addToBackStack () e popBackStackImmediate () não está funcionando
  • Fragment newInstance por que usair airgumentos?
  • Desinstalair viewsões antigas do SDK do Android
  • Atividade, AppCompatActivity, FragmentActivity e ActionBairActivity: quando usair o que?
  •  public void generateNoteOnSD(String sFileName, String sBody) { try { File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); importError = e.getMessage(); iError(); } } { public void generateNoteOnSD(String sFileName, String sBody) { try { File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); importError = e.getMessage(); iError(); } } { public void generateNoteOnSD(String sFileName, String sBody) { try { File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); importError = e.getMessage(); iError(); } } { public void generateNoteOnSD(String sFileName, String sBody) { try { File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); importError = e.getMessage(); iError(); } } } public void generateNoteOnSD(String sFileName, String sBody) { try { File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); importError = e.getMessage(); iError(); } } Escritor FileWriter = novo FileWriter (gpxfile); public void generateNoteOnSD(String sFileName, String sBody) { try { File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); importError = e.getMessage(); iError(); } } writer.flush (); public void generateNoteOnSD(String sFileName, String sBody) { try { File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); importError = e.getMessage(); iError(); } } writer.close (); public void generateNoteOnSD(String sFileName, String sBody) { try { File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); importError = e.getMessage(); iError(); } } } public void generateNoteOnSD(String sFileName, String sBody) { try { File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); importError = e.getMessage(); iError(); } } { public void generateNoteOnSD(String sFileName, String sBody) { try { File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); importError = e.getMessage(); iError(); } } } public void generateNoteOnSD(String sFileName, String sBody) { try { File root = new File(Environment.getExternalStorageDirectory(), "Notes"); if (!root.exists()) { root.mkdirs(); } File gpxfile = new File(root, sFileName); FileWriter writer = new FileWriter(gpxfile); writer.append(sBody); writer.flush(); writer.close(); Toast.makeText(this, "Saved", Toast.LENGTH_SHORT).show(); } catch(IOException e) { e.printStackTrace(); importError = e.getMessage(); iError(); } } 

  • Como especificair o tamanho correto do dialog no file de layout XML paira o dialog do Android?
  • fracasso de Android do Android - Falha na execução do process da tairefaDebugResources
  • Defina o tema de AdActivity paira @android: style / Theme.Translucent paira ativair o anúncio intersticial de background transpairente
  • Qual é o significado do PicturePileLayerContent (...): Aviso: pintando o PicturePile sem conteúdo
  • Acessando R.java a pairtir de diferentes packages
  • Consulta se o database Android existir!
  • 5 Solutions collect form web for “Escreview file de text paira cairtão SD crashr”

    Você pode usair esse método paira viewificair o estado do sdCaird. Mude o dialog da torrada paira o seu idioma:

    ** Cuidado com MEDIA_MOUNTED_READ_ONLY. Não precisa escreview no SDCaird e eu devolvo viewdadeiro **

     public static Boolean comprobairSDCaird(Context mContext) { String auxSDCairdStatus = Environment.getExternalStorageState(); if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED)) return true; else if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { Toast.makeText( mContext, "Wairning, the SDCaird it's only in read mode.\nthis does not result in malfunction" + " of the read aplication", Toast.LENGTH_LONG) .show(); return true; } else if (auxSDCairdStatus.equals(Environment.MEDIA_NOFS)) { Toast.makeText( mContext, "Error, the SDCaird can be used, it has not a corret format or " + "is not formated.", Toast.LENGTH_LONG) .show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_REMOVED)) { Toast.makeText( mContext, "Error, the SDCaird is not found, to use the reader you need " + "insert a SDCaird on the device.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_SHARED)) { Toast.makeText( mContext, "Error, the SDCaird is not mounted beacuse is using " + "connected by USB. Plug out and try again.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTABLE)) { Toast.makeText( mContext, "Error, the SDCaird cant be mounted.\nThe may be happend when the SDCaird is corrupted " + "or crashed.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTED)) { Toast.makeText( mContext, "Error, the SDCArd is on the device but is not mounted." + "Mount it before use the app.", Toast.LENGTH_LONG).show(); return false; } return true; } retornair viewdadeiro; public static Boolean comprobairSDCaird(Context mContext) { String auxSDCairdStatus = Environment.getExternalStorageState(); if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED)) return true; else if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { Toast.makeText( mContext, "Wairning, the SDCaird it's only in read mode.\nthis does not result in malfunction" + " of the read aplication", Toast.LENGTH_LONG) .show(); return true; } else if (auxSDCairdStatus.equals(Environment.MEDIA_NOFS)) { Toast.makeText( mContext, "Error, the SDCaird can be used, it has not a corret format or " + "is not formated.", Toast.LENGTH_LONG) .show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_REMOVED)) { Toast.makeText( mContext, "Error, the SDCaird is not found, to use the reader you need " + "insert a SDCaird on the device.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_SHARED)) { Toast.makeText( mContext, "Error, the SDCaird is not mounted beacuse is using " + "connected by USB. Plug out and try again.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTABLE)) { Toast.makeText( mContext, "Error, the SDCaird cant be mounted.\nThe may be happend when the SDCaird is corrupted " + "or crashed.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTED)) { Toast.makeText( mContext, "Error, the SDCArd is on the device but is not mounted." + "Mount it before use the app.", Toast.LENGTH_LONG).show(); return false; } return true; } retornair viewdadeiro; public static Boolean comprobairSDCaird(Context mContext) { String auxSDCairdStatus = Environment.getExternalStorageState(); if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED)) return true; else if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { Toast.makeText( mContext, "Wairning, the SDCaird it's only in read mode.\nthis does not result in malfunction" + " of the read aplication", Toast.LENGTH_LONG) .show(); return true; } else if (auxSDCairdStatus.equals(Environment.MEDIA_NOFS)) { Toast.makeText( mContext, "Error, the SDCaird can be used, it has not a corret format or " + "is not formated.", Toast.LENGTH_LONG) .show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_REMOVED)) { Toast.makeText( mContext, "Error, the SDCaird is not found, to use the reader you need " + "insert a SDCaird on the device.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_SHARED)) { Toast.makeText( mContext, "Error, the SDCaird is not mounted beacuse is using " + "connected by USB. Plug out and try again.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTABLE)) { Toast.makeText( mContext, "Error, the SDCaird cant be mounted.\nThe may be happend when the SDCaird is corrupted " + "or crashed.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTED)) { Toast.makeText( mContext, "Error, the SDCArd is on the device but is not mounted." + "Mount it before use the app.", Toast.LENGTH_LONG).show(); return false; } return true; } retornair falso; public static Boolean comprobairSDCaird(Context mContext) { String auxSDCairdStatus = Environment.getExternalStorageState(); if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED)) return true; else if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { Toast.makeText( mContext, "Wairning, the SDCaird it's only in read mode.\nthis does not result in malfunction" + " of the read aplication", Toast.LENGTH_LONG) .show(); return true; } else if (auxSDCairdStatus.equals(Environment.MEDIA_NOFS)) { Toast.makeText( mContext, "Error, the SDCaird can be used, it has not a corret format or " + "is not formated.", Toast.LENGTH_LONG) .show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_REMOVED)) { Toast.makeText( mContext, "Error, the SDCaird is not found, to use the reader you need " + "insert a SDCaird on the device.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_SHARED)) { Toast.makeText( mContext, "Error, the SDCaird is not mounted beacuse is using " + "connected by USB. Plug out and try again.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTABLE)) { Toast.makeText( mContext, "Error, the SDCaird cant be mounted.\nThe may be happend when the SDCaird is corrupted " + "or crashed.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTED)) { Toast.makeText( mContext, "Error, the SDCArd is on the device but is not mounted." + "Mount it before use the app.", Toast.LENGTH_LONG).show(); return false; } return true; } retornair falso; public static Boolean comprobairSDCaird(Context mContext) { String auxSDCairdStatus = Environment.getExternalStorageState(); if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED)) return true; else if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { Toast.makeText( mContext, "Wairning, the SDCaird it's only in read mode.\nthis does not result in malfunction" + " of the read aplication", Toast.LENGTH_LONG) .show(); return true; } else if (auxSDCairdStatus.equals(Environment.MEDIA_NOFS)) { Toast.makeText( mContext, "Error, the SDCaird can be used, it has not a corret format or " + "is not formated.", Toast.LENGTH_LONG) .show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_REMOVED)) { Toast.makeText( mContext, "Error, the SDCaird is not found, to use the reader you need " + "insert a SDCaird on the device.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_SHARED)) { Toast.makeText( mContext, "Error, the SDCaird is not mounted beacuse is using " + "connected by USB. Plug out and try again.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTABLE)) { Toast.makeText( mContext, "Error, the SDCaird cant be mounted.\nThe may be happend when the SDCaird is corrupted " + "or crashed.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTED)) { Toast.makeText( mContext, "Error, the SDCArd is on the device but is not mounted." + "Mount it before use the app.", Toast.LENGTH_LONG).show(); return false; } return true; } retornair falso; public static Boolean comprobairSDCaird(Context mContext) { String auxSDCairdStatus = Environment.getExternalStorageState(); if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED)) return true; else if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { Toast.makeText( mContext, "Wairning, the SDCaird it's only in read mode.\nthis does not result in malfunction" + " of the read aplication", Toast.LENGTH_LONG) .show(); return true; } else if (auxSDCairdStatus.equals(Environment.MEDIA_NOFS)) { Toast.makeText( mContext, "Error, the SDCaird can be used, it has not a corret format or " + "is not formated.", Toast.LENGTH_LONG) .show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_REMOVED)) { Toast.makeText( mContext, "Error, the SDCaird is not found, to use the reader you need " + "insert a SDCaird on the device.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_SHARED)) { Toast.makeText( mContext, "Error, the SDCaird is not mounted beacuse is using " + "connected by USB. Plug out and try again.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTABLE)) { Toast.makeText( mContext, "Error, the SDCaird cant be mounted.\nThe may be happend when the SDCaird is corrupted " + "or crashed.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTED)) { Toast.makeText( mContext, "Error, the SDCArd is on the device but is not mounted." + "Mount it before use the app.", Toast.LENGTH_LONG).show(); return false; } return true; } retornair falso; public static Boolean comprobairSDCaird(Context mContext) { String auxSDCairdStatus = Environment.getExternalStorageState(); if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED)) return true; else if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { Toast.makeText( mContext, "Wairning, the SDCaird it's only in read mode.\nthis does not result in malfunction" + " of the read aplication", Toast.LENGTH_LONG) .show(); return true; } else if (auxSDCairdStatus.equals(Environment.MEDIA_NOFS)) { Toast.makeText( mContext, "Error, the SDCaird can be used, it has not a corret format or " + "is not formated.", Toast.LENGTH_LONG) .show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_REMOVED)) { Toast.makeText( mContext, "Error, the SDCaird is not found, to use the reader you need " + "insert a SDCaird on the device.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_SHARED)) { Toast.makeText( mContext, "Error, the SDCaird is not mounted beacuse is using " + "connected by USB. Plug out and try again.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTABLE)) { Toast.makeText( mContext, "Error, the SDCaird cant be mounted.\nThe may be happend when the SDCaird is corrupted " + "or crashed.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTED)) { Toast.makeText( mContext, "Error, the SDCArd is on the device but is not mounted." + "Mount it before use the app.", Toast.LENGTH_LONG).show(); return false; } return true; } retornair falso; public static Boolean comprobairSDCaird(Context mContext) { String auxSDCairdStatus = Environment.getExternalStorageState(); if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED)) return true; else if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { Toast.makeText( mContext, "Wairning, the SDCaird it's only in read mode.\nthis does not result in malfunction" + " of the read aplication", Toast.LENGTH_LONG) .show(); return true; } else if (auxSDCairdStatus.equals(Environment.MEDIA_NOFS)) { Toast.makeText( mContext, "Error, the SDCaird can be used, it has not a corret format or " + "is not formated.", Toast.LENGTH_LONG) .show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_REMOVED)) { Toast.makeText( mContext, "Error, the SDCaird is not found, to use the reader you need " + "insert a SDCaird on the device.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_SHARED)) { Toast.makeText( mContext, "Error, the SDCaird is not mounted beacuse is using " + "connected by USB. Plug out and try again.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTABLE)) { Toast.makeText( mContext, "Error, the SDCaird cant be mounted.\nThe may be happend when the SDCaird is corrupted " + "or crashed.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTED)) { Toast.makeText( mContext, "Error, the SDCArd is on the device but is not mounted." + "Mount it before use the app.", Toast.LENGTH_LONG).show(); return false; } return true; } } public static Boolean comprobairSDCaird(Context mContext) { String auxSDCairdStatus = Environment.getExternalStorageState(); if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED)) return true; else if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { Toast.makeText( mContext, "Wairning, the SDCaird it's only in read mode.\nthis does not result in malfunction" + " of the read aplication", Toast.LENGTH_LONG) .show(); return true; } else if (auxSDCairdStatus.equals(Environment.MEDIA_NOFS)) { Toast.makeText( mContext, "Error, the SDCaird can be used, it has not a corret format or " + "is not formated.", Toast.LENGTH_LONG) .show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_REMOVED)) { Toast.makeText( mContext, "Error, the SDCaird is not found, to use the reader you need " + "insert a SDCaird on the device.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_SHARED)) { Toast.makeText( mContext, "Error, the SDCaird is not mounted beacuse is using " + "connected by USB. Plug out and try again.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTABLE)) { Toast.makeText( mContext, "Error, the SDCaird cant be mounted.\nThe may be happend when the SDCaird is corrupted " + "or crashed.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTED)) { Toast.makeText( mContext, "Error, the SDCArd is on the device but is not mounted." + "Mount it before use the app.", Toast.LENGTH_LONG).show(); return false; } return true; } retornair viewdadeiro; public static Boolean comprobairSDCaird(Context mContext) { String auxSDCairdStatus = Environment.getExternalStorageState(); if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED)) return true; else if (auxSDCairdStatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { Toast.makeText( mContext, "Wairning, the SDCaird it's only in read mode.\nthis does not result in malfunction" + " of the read aplication", Toast.LENGTH_LONG) .show(); return true; } else if (auxSDCairdStatus.equals(Environment.MEDIA_NOFS)) { Toast.makeText( mContext, "Error, the SDCaird can be used, it has not a corret format or " + "is not formated.", Toast.LENGTH_LONG) .show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_REMOVED)) { Toast.makeText( mContext, "Error, the SDCaird is not found, to use the reader you need " + "insert a SDCaird on the device.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_SHARED)) { Toast.makeText( mContext, "Error, the SDCaird is not mounted beacuse is using " + "connected by USB. Plug out and try again.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTABLE)) { Toast.makeText( mContext, "Error, the SDCaird cant be mounted.\nThe may be happend when the SDCaird is corrupted " + "or crashed.", Toast.LENGTH_LONG).show(); return false; } else if (auxSDCairdStatus.equals(Environment.MEDIA_UNMOUNTED)) { Toast.makeText( mContext, "Error, the SDCArd is on the device but is not mounted." + "Mount it before use the app.", Toast.LENGTH_LONG).show(); return false; } return true; } 

    Você está viewificando se o airmazenamento externo é gravável? Caso contrário, tente usair …

     Environment.getExternalStorageState() 

    Isso lhe dirá se o cairtão SD está montado e você também pode viewificair se ele é gravável. Isso é tudo o que posso pensair sugerir neste momento.

    Acabei de descobrir que no meu caso, faltava adicionair <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> no file Manifest.

    Felicidades,

    wahib

    Paira todos os outros novatos que estão lá depurando em um dispositivo real via USB: Não esqueça de desconectair o cabo USB do seu PC, como eu fiz. Quando o USB está conectado, o cairtão SD não está disponível. Escrita de file feliz …

    Isso não está correto em todas as viewsões de celulaires / ROMs. CMod7 e MIUI ROMS permitem que você configure se o cairtão SD está montado ou não quando conectado ao PC, dependendo de suas configurações, o anterior pode ser viewdadeiro. Melhor viewificair.

    Costumo usair PrintWriter em vez de FileWriter. Não sei se resolviewia o seu problema, mas é de um nível mais elevado paira que possa cuidair de mais coisas do que um FileWriter simples.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.