title: how to save the image in sdcard in android
body: <p>i am working on OpenGl Es in android.given efects on images and when i save the image in sdcard it showing black image.how i solve this problem. </p>
  
  <p>File cacheDir;
                       Toast.makeText(ImageProcessingActivity.this, "Photo", 500).show();</p>
  
  <pre><code>                 Bitmap icon;
                   frame.setDrawingCacheEnabled(true);
  
                   icon = Bitmap.createBitmap(frame.getDrawingCache());
                   Bitmap bitmap = icon;
                   frame.setDrawingCacheEnabled(false);
                   // File mFile1 = Environment.getExternalStorageDirectory();
                   Date d = new Date();
                   String fileName = d.getTime() + "mg1.jpg";
  
                   File storagePath = (Environment.getExternalStorageDirectory());
                   File dest = new File(storagePath + "/CityAppImages");
  
                   if (!dest.exists()) {
                   dest.mkdirs();
  
                   }
  
                   File mFile2 = new File(dest, fileName);
                   sdpath = mFile2.getAbsolutePath();
  
                   Log.d("qqqqqqqqqqqqqqqqqqqqqqq", "zzzzzzzz" + sdpath);
                   try {
                   FileOutputStream outStream;
  
                   outStream = new FileOutputStream(mFile2);
  
                   bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outStream);
  
                   outStream.flush();
  
                   outStream.close();
                   Toast.makeText(ImageProcessingActivity.this, "Photo Saved Sucessfully", 500)
                   .show();
                   image.setImageBitmap(bitmap);
                   } catch (FileNotFoundException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
                   } catch (IOException e) {
  
                   // TODO Auto-generated catch block
                   e.printStackTrace();
                   Toast.makeText(ImageProcessingActivity.this, "Photo Not Saved Sucessfully",500).show();
                   }
  </code></pre>