i'm creating a excel file by FileOutputStream.
private boolean saveExcelFile(Context context, final String fileName) {
if (!isExternalStorageAvailable() || isExternalStorageReadOnly()) {
checkRunTimePermission();
return false;
}
final boolean[] success = {false};
GetAllPeople(new VolleyCallBack() {
@Override
public void onSuccess() {
Workbook wb = new HSSFWorkbook();
Cell c = null;
CellStyle cs = wb.createCellStyle();
Sheet sheet1 = null;
sheet1 = wb.createSheet("مخاطبین");
Row row = sheet1.createRow(0);
c = row.createCell(0);
c.setCellValue("شماره تماس");
c = row.createCell(1);
c.setCellValue("نام و نام خانوادگی");
File root = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
if (!root.exists()) {
root.setReadable(true);
root.setWritable(true);
root.mkdirs();
}
File file = new File(root, fileName);
FileOutputStream os = null;
try {
os = new FileOutputStream(file);
wb.write(os);
success[0] = true;
} catch (IOException e) {
} catch (Exception e) {
} finally {
try {
if (null != os)
os.close();
}
catch (Exception ex) {
}
}
}
});
return success[0];
}
note:i Added storage permission on Manifest. file is creating successfully and without any errors. i'm searching file name in file explorer but I can't find this file.