开发者

Android writing to a CSV file via OpenCsv

I tr开发者_运维知识库y to write to a Csv file via:

mFileWriter = new FileWriter(
        "/sdcard/program/file");

mCsvWriter = new CSVWriter(mFileWriter);

At the moment it throws an exception that the file doesn't exist. It's true that the file doesn't exist. What's the easiest way to create the file?


Does the FILE not exist, or the DIRECTORY it's supposed to go into?

If you want to create a directory structure, you can always do

File file = new File("/full/path/to/file");
file.mkdirs();

This will create any path leading up to this file that doesn't exist yet.

I suppose the missing quotes around your file name are a typo?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜