I am trying to save a PDF file to an external Storage Directory. I think I am missing something obvious, so perhaps we can solve this together.
First I click my save button and check the directory exists.
File direct = new File(Environment.getExternalStorageDirectory() + "/CompanyName");
//if directory does not exist then create it
if (!direct.exists()) {
filedir.mkdirs();
}
Then I need to save the PDF File. The way my app is setup I have the PDF already downloaded into my PDF viewer so I can access the file directly. I think I am missing a key concept here, but most online answers are for images or creating text files.
pdfFile = new File(direct, imageTitle.getText().toString());
try {
//try to create a new file
pdfFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}