Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting IO exception while creating file in Android?
    text
    copied!<p>I am working in an application and getting very silly exception when I create file after creating folder in my SDCARD. I am working with Below code: </p> <pre><code>private void downloadFileFromURL(String filePath){ String extStorageDirectory = Environment.getExternalStorageDirectory() .toString(); File folder = new File(extStorageDirectory, "PS/BC_REPO"); folder.mkdir(); File file=new File(folder, "My_QR_Image.jpg"); try { file.createNewFile(); } catch (IOException e1) { e1.printStackTrace(); } boolean pdfSize=Downloader.downloadFile(QRCodeImageURL1, file, GetAllDataFromServerActivity.this); if(pdfSize){ System.out.println("downloaded"); } } java.io.IOException: Not a directory at java.io.File.createNewFileImpl(Native Method) at java.io.File.createNewFile(File.java:1160) t com.tech.persociety.GetAllDataFromServerActivity.downloadFileFromURL(GetAllDataFromServerActivity.java:614) at com.tech.persociety.GetAllDataFromServerActivity.getJsonResponse(GetAllDataFromServerActivity.java:169) at com.tech.persociety.GetAllDataFromServerActivity.access$0(GetAllDataFromServerActivity.java:124) at com.tech.persociety.GetAllDataFromServerActivity$1.dispatchMessage(GetAllDataFromServerActivity.java:108) at com.tech.persociety.GetAllDataFromServerActivity.serverResponse(GetAllDataFromServerActivity.java:103) at com.tech.servercommunication.WebServiceCommunicator.notifyRegisteredUser(WebServiceCommunicator.java:225) at com.tech.servercommunication.WebServiceCommunicator.handleResponse(WebServiceCommunicator.java:211) at com.tech.servercommunication.WebServiceCommunicator$2.run(WebServiceCommunicator.java:99) at java.lang.Thread.run(Thread.java:1096) : W/System.err(6175): java.io.IOException: Not a directory at java.io.File.createNewFileImpl(Native Method) at java.io.File.createNewFile(File.java:1160) at com.tech.persociety.Downloader.downloadFile(Downloader.java:32) at com.tech.persociety.GetAllDataFromServerActivity.downloadFileFromURL(GetAllDataFromServerActivity.java:623) at com.tech.persociety.GetAllDataFromServerActivity.getJsonResponse(GetAllDataFromServerActivity.java:169) at com.tech.persociety.GetAllDataFromServerActivity.access$0(GetAllDataFromServerActivity.java:124) at com.tech.persociety.GetAllDataFromServerActivity$1.dispatchMessage(GetAllDataFromServerActivity.java:108) at com.tech.persociety.GetAllDataFromServerActivity.serverResponse(GetAllDataFromServerActivity.java:103) at com.tech.servercommunication.WebServiceCommunicator.notifyRegisteredUser(WebServiceCommunicator.java:225) at com.tech.servercommunication.WebServiceCommunicator.handleResponse(WebServiceCommunicator.java:211) at com.tech.servercommunication.WebServiceCommunicator$2.run(WebServiceCommunicator.java:99) at java.lang.Thread.run(Thread.java:1096) </code></pre> <p>I have to create a FOLDER PS inside which I have to create another folder BCREPO inside which I have to create a JPG file. But getting failed in this.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload