我创建Excel文件,将其存储在内部存储,但我不能只do.It应用存储directory.Not可见在public.How创建文件夹,存储文件夹中的文件中创建?任何人都可以知道一个帮我解决这个问题。
创建文件编码
public String generate(String file_name,String path) {
try {
f = new File(activity.getFilesDir(), path);
if (!f.exists()) {
f.mkdirs();
}
file = new File(f.getAbsolutePath(), file_name);
if (file.createNewFile()) {
file.createNewFile();
}
wb_setting = new WorkbookSettings();
wb_setting.setLocale(new Locale("en", "EN"));
workbook = Workbook.createWorkbook(file, wb_setting);
workbook.createSheet("Report", 0);
excelSheet = workbook.getSheet(0);
createLabel(excelSheet);
createContent(excelSheet);
workbook.write();
workbook.close();
file_path_alert_builder = new AlertDialog.Builder(activity);
file_path_alert_builder.setTitle("File path");
file_path_alert_builder.setMessage(""+file).setCancelable(true).setPositiveButton("OK",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
file_path_dialog = file_path_alert_builder.create();
file_path_dialog.show();
}catch (JXLException jxl_e) {
jxl_e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}