title: Save bitmap image in chunks
body: <p>I want to save bitmap image in sd card, i am able to save it but some time my activity is killed because of low ram.</p>
  
  <p>So can i save image in chunks rather to save in form of byte array.</p>
  
  <p>My code is like below:</p>
  
  <pre><code>    try {
          ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  
          b.compress(Bitmap.CompressFormat.JPEG, 40, bytes);
  
          File f = new File(Environment.getExternalStorageDirectory() + File.separator + "temp.jpg");
          if (f.exists()) {
              f.delete();
          }
          f.createNewFile();
  
          FileOutputStream fo = new FileOutputStream(f);
          fo.write(bytes.toByteArray());
          fo.flush();
          fo.close();
  
      } catch (Exception e) {
  
          e.printStackTrace();
      }
  </code></pre>