vendredi 15 juillet 2016

java.io.IOException: null InputStream?

i'm trying to create file in external memory using getExternalStoragePublicDirectory() but logcat shows error java.io.IOException: null InputStream .please help

public void process4(){

        String s=et.getText().toString();

       File folder= Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
        File objFile=new File(folder,"myText.txt");
        FileOutputStream fileOutputStream= null;

        try {

            fileOutputStream = new FileOutputStream(objFile);
            fileOutputStream.write(s.getBytes());

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
}

logcat status:

E/DropBoxTask: null InputStream
java.io.IOException: null InputStream
   at xrr.a(SourceFile:182)
   at xrr.b(SourceFile:124)
   at xqy.a(SourceFile:88)
   at com.google.android.gms.stats.service.DropBoxEntryAddedChimeraService.onHandleIntent(SourceFile:1159)
   at beq.handleMessage(SourceFile:65)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:135)
   at android.os.HandlerThread.run(HandlerThread.java:61)

Aucun commentaire:

Enregistrer un commentaire