此代码用于将图片保存在 /Android/data/com.ocr.id/files/IDOCR/Number/
public static File save(Activity activity, Bitmap bm, String name) {
    boolean mExternalStorageAvailable = false;
    boolean mExternalStorageWriteable = false;
    File number = null;
    String state = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(state)) {
        // We can read and write the media
        mExternalStorageAvailable = mExternalStorageWriteable = true;
        OutputStream outStream = null;
        File externalFilesDir = activity.getExternalFilesDir(null);
        File outFile = new File(externalFilesDir, "IDOCR" + File.separator
                + "Numbers");
        if (!outFile.exists())
            outFile.mkdirs();
        String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss")
                .format(new Date());
        number = new File(outFile, timeStamp + "_" + name + ".PNG");
        try {
            outStream = new FileOutputStream(number);
            bm.compress(Bitmap.CompressFormat.PNG, 100, outStream);
            outStream.flush();
            outStream.close();
            outStream = null;
            bm.recycle();
//              bm = null;
            System.gc();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
        // We can only read the media
        mExternalStorageAvailable = true;
        mExternalStorageWriteable = false;
        Toast.makeText(activity, "Your SDcared is read only.",
                Toast.LENGTH_LONG).show();
    } else {
        // Something else is wrong. It may be one of many other states, but
        // all we need
        // to know is we can neither read nor write
        mExternalStorageAvailable = mExternalStorageWriteable = false;
        Toast.makeText(activity, "Your SDcared is unmounted.",
                Toast.LENGTH_LONG).show();
    }
    return number;
}
该代码中的错误是什么,该代码抛出空指针异常作为这一行
            bm.compress(Bitmap.CompressFormat.PNG, 100, outStream);
这段代码以前和我一起工作,但现在给我一个异常。