我从 android 创建了一个 excel 文件,当我将手机连接到计算机时,然后在计算机中我无法看到该文件。这是为什么?
Workbook wb = new HSSFWorkbook();
Cell c = null;
//Cell style for header row
CellStyle cs = wb.createCellStyle();
//New Sheet
Sheet sheet1 = null;
sheet1 = wb.createSheet("Meter Readings");
// Generate column headings
Row row = sheet1.createRow(1);
c = row.createCell(0);
c.setCellValue("Flat Number");
c.setCellStyle(cs);
sheet1.setColumnWidth(0, (15 * 200));
// Create a path where we will place our List of objects on external storage
File file = new File(context.getExternalFilesDir(null),fileName);
FileOutputStream os = null;
try {
os = new FileOutputStream(file);
wb.write(os);
Log.w("FileUtils", "Writing file" + file);
success = true;
//os.close();
} catch (IOException e) {
Log.w("FileUtils", "Error writing " + file, e);
} catch (Exception e) {
Log.w("FileUtils", "Failed to save file", e);
} finally {
try {
if (null != os) {
os.close();
}
} catch (Exception ex) {
}
}
最佳答案
您需要重新启动手机或重新连接到您的电脑。
关于java - 手机sd卡连接电脑看不到文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45729284/