找不到文件异常写入文件

时间:2019-05-22 12:42:30

标签: android

try {
        File myFile = new File(android.os.Environment.getExternalStorageDirectory() + fileName);

        BufferedInputStream buf = new BufferedInputStream(new FileInputStream(myFile));
        buf.read(buffer, 0, buffer.length);
        buf.close();
    } catch (FileNotFoundException e) {
        Toast.makeText(getApplicationContext(),"File Not Found"+fileName,Toast.LENGTH_LONG).show();
        e.printStackTrace();
    } catch (IOException e) {
        Toast.makeText(getApplicationContext(),"IOException",Toast.LENGTH_LONG).show();
        e.printStackTrace();
    }

0 个答案:

没有答案