salimdz Posted January 29, 2011 Share Posted January 29, 2011 Bonjour, Je veux écrire dans la carte SD, voila le code : try { String Fichiers = NOTES + WilayaCode + EXT; File file = new File(Environment.getExternalStorageDirectory(), Fichiers); file.createNewFile(); FileWriter filewriter = new FileWriter(file,false); filewriter.write(InfoWilaya); filewriter.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } mais je veux ajoute la vérification de présence de cette carte SD. J’attends votre aide. Bonne journée a+ Link to comment Share on other sites More sharing options...
eephyne Posted January 29, 2011 Share Posted January 29, 2011 ça devrait t'aider http://developer.android.com/reference/android/os/Environment.html#MEDIA_MOUNTED Link to comment Share on other sites More sharing options...
salimdz Posted January 29, 2011 Author Share Posted January 29, 2011 ça devrait t'aider http://developer.android.com/reference/android/os/Environment.html#MEDIA_MOUNTED bonjour, merci pour votre réponse. bonne journée a+ Link to comment Share on other sites More sharing options...
salimdz Posted January 30, 2011 Author Share Posted January 30, 2011 Bonjour, J’ai essayé avec l’AVD Emulateur et j'ai cette remarque : ce code de vérification, na pas marché : if (Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED) { ... } et après plusieurs tentative de teste, j’ai trouve un code de vérification qui marche bien, le voila : if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { ... } Bonne journée a+ Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.