title: how to open a file on android
body: <p>I am new to android and programming. I am using the android touchpaint api, and using the following code to save a drawing, but obviously saving is useless without being able to open the file.</p>
  
  <p>I was wondering if anyone could help me with some code for it.</p>
  
  <pre><code>    // Function saves image to file
  public String save(Bitmap mBitmap, boolean showMsg) {
      String filename;
      Date date = new Date();
      SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
      filename = sdf.format(date);
      try {
  
          String path = Environment.getExternalStorageDirectory().toString() + "/modTouchPaint/";
          File file1 = new File(path);
          file1.mkdirs();
  
          OutputStream fOut = null;
          File file = new File(path, filename + ".jpg");
          fOut = new FileOutputStream(file);
  
          mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fOut);
          fOut.flush();
          fOut.close();
  
          if (showMsg)
              Toast.makeText(this, "Picture saved to " + path + filename + ".jpg", 9000).show();
  
          return path + filename + ".jpg";
      } catch (Exception e) {
          e.printStackTrace();
  
          Toast.makeText(this, "Please make sure that SD card is installed", 5000).show();
  
          return null;
      }
  } 
  </code></pre>