How to update album art of any specific song

I am creating an app from which I could update album art of the songs, I have tried mp3agic library but it’s not working for me. I have already read similar questions related to this but I don’t have album id of the song only I have is the location and filename, Is there any way to find album id of the song by it’s name or update manually with any library. Thanks.

Answer

    String DISPLAY_NAME = MediaStore.Audio.Media.DISPLAY_NAME;
    String projection[] = {MediaStore.Audio.Media.ALBUM_ID};
    String selection = DISPLAY_NAME + " = ?";
    String[] selectionArgs = {"your file name.mp3"};
    String order = null;

    Cursor cursor = getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
            projection, selection, selectionArgs, order);
    // **now use cursor** //

Leave a Reply

Your email address will not be published. Required fields are marked *