Skip to content Skip to sidebar Skip to footer

Outputstreamwriter Not Writing

I have created a file with an asynctask. Afterwards scheduled an executor to write information to said file once every second. Once I touch a button the executor is shut down and t

Solution 1:

I think your problem may be here

new CreateFileTask(fileName).execute();
   loc_file =new File(fileName);

I assume this task creates the file and you're expecting that when you can new File(fileName) the file is already created. Whether this is true or not is indeterminate. If the AsyncTask CreateFileTask is scheduled to run and completes before the next statement is executed then the file will be there, otherwise it won't be. Are you seeing stack traces in logcat from the IOException or FileNoteFoundExceptions?

Post a Comment for "Outputstreamwriter Not Writing"