I need to save a bitmap to the Gallery using my application name as the album. The path should be:
Gallery->MyAppName->test.png
but the best result that I get looks like:
Gallery->Others->MyAppName->test.png
Here is my code:
using Android.Graphics; using Android.Media; using System; using System.IO; .. . . public static void ExportBitmapAsPNG(Bitmap bitmap) { var sdCardPath = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath+"/MyAppName"; if (!Directory.Exists(sdCardPath)) Directory.CreateDirectory(sdCardPath); var filePath = System.IO.Path.Combine(sdCardPath, "test.png"); var stream = new FileStream(filePath, FileMode.Create); bitmap.Compress(Bitmap.CompressFormat.Png, 100, stream); stream.Close(); MediaScannerConnection.ScanFile(Android.App.Application.Context, new string[] { filePath }, null, null); } I hope someone could tell me what I'm missing?
P.S. I tried to use MediaStore, but it's always save in Picture folder and has no overloads to change this.
Android.Provider.MediaStore.Images.Media.InsertImage(ContentResolver, bitmap2, "test", "");