Forum Xamarin Xamarin.Android

Deleting images leaves a blank grey square on device

Using a statement like the below:

The device I am using is:
Moto G5
Android 8.1

Has anyone seen anything like this?

Any help would be appreciated.

Thanks in advance



  • LeoZhuLeoZhu Member ✭✭✭

    After saving the pictures of the android system, the thumbnails will be recorded in the media database, so when deleting the corresponding pictures, the corresponding records in the database will also be deleted
    you could try the method:
    ContentResolver.Delete(MediaStore.Images.Media.ExternalContentUri, MediaStore.Images.Media.InterfaceConsts.Data + "=?", new string[] { TheImageURL });

  • jaydee_virjaydee_vir Member ✭✭

    @LeoZhu thanks for the response.

    As i'm using Xamarin Forms, I've put this into a dependancy service so that I can call the Android code like you suggested.

    However, this still creates issues as the "ContentResolver.Delete" function, which uses "using Android.Content" errors as the "MediaStore.xxxx" requires " using Android.Provider"


  • PatrickJelittoPatrickJelitto Member ✭✭✭

    Is your Image element bound to the path of your image? when the image is deleted and the imagepath property uses the notifypropertychanged event then your element will update to a image element with no path, which results in a grey background.

Sign In or Register to comment.