android - Bitmap is not saving in SD Card -
updated I'm trying to save bitmap to the SD card I am The code is working, showing no errors and exceptions, but the image is not saved in the gallery. Please help log report I'm doing this after the setContentView in MainActivity, And I call this function to save the image You need to update the gallery after saving; Like this:
07-25 04: 26: 04.126: D / Deluxe (2453): GC_Farlalok Free 82, 7% free 2788/2 9 76, 210 seconds Paused Total 228ms 07-25 April: 26: 04.168: 26 :: 04.306: 1,127,536-Byte Allocation Increase the pile (frag case) for 07-25 April are 3.894MB: I / dalvikvm-pile (2453) D / dalvikvm (2453): GC_FOR_ALLOC free 3887K / 4080K free 2K, 5%, paused 137ms, total 137ms 07-25 Apr: 26: 04.375: E / MainActivity ( 2453): 26 :: 04.706: Error occurred in the fragment 07-25 April / Cyro Rafr (2453): Omitted 30 frames! The application may be doing a lot of work on the main thread 07-25 04: 26: 04.735: D / Grolok_Goldfish (2453): Emulator detected without GPU simulation. 07-25 Apr: 26: 09326: D / dalvikvm (2453): GC_FOR_ALLOC 114K released, 5% free 4285K / 4500K, paused 29ms, total 35ms 07-25 April: 26:12, 26: d / dalvikvm (2453): GC_FOR_ALLOC released 52K, 4% free of 4426 k / 4580, paused 38 mms, total 44 ms 07-25 04: 26: 12.036: i / dalvikum-hap (2453): Hep (frog case) Increased to 5,531 MB 1166416-byte allocation 07-25 04: 26: 12.107: D / dalvikvm (2453): GC_FOR_ALLOC free 5563K / 5720K free 2K, 3%, paused 69ms, total 69ms 07-25 April: 26: 12.266: D / dalvikvm (2453): GC_FOR_ALLOC released & lt; 1K, 3% free of 5563/5720, paused 29ms, total 29ms 07-25 04: 26: 12.276: i / dalvikum-hep (2453): increase the hague (frog case) to 6.641 MB 116,646-byte allocation 07-25 04:26: 12.316: D / dalvikvm (2453): GC_FOR_ALLOC released & lt; 1K, 3% free 6702K / 6860K, 36ms, total 36ms paused
// SD Find the card path filepath = Environment.getExternalStorageDirectory ();
Public Zero Satellite (Bitmap Bitmap) {OutputStream Output; // Create a new folder in the SD card file dir = new file (filepath.getAbsolutePath () + "Save / Image Tutorial"); Dir.mkdirs (); String fName = "ige" + ".png"; // Create a name for the saved image file file = new file (DIR, FNNAM); Try {output = new FileOutputStream (file); // png format image in 0% - 100% bitmap.compress (bitmap.CompressFormat.PNG, 100, output); Output.flush (); Output.close (); // Show a toast message on successful saved toast. Maketext (main activity., "Image saved in SD card", Toast. LNNGHHORT). Show (); } Hold (exception e) {e.printStackTrace (); // Show a toast message on successful saved toast. Maketext (Main activation., "Save failed", Toast. LNNGHHORT). Show (); }}
getContext () sendBroadcast (new intent (Intent.ACTION_MEDIA_MOUNTED, Uri.parse ("file: //". + Environment.getExternalStorageDirectory ()) ));
Comments
Post a Comment