try {
      MediaMetadataRetriever retriever = new MediaMetadataRetriever();
     // set file path /data/user/0/mp3
      retriever.setDataSource(filePath);

     // get music poster in bytes
      byte[] art = retriever.getEmbeddedPicture();

      if (art != null) {
        // Convert the byte array into a Bitmap
        Bitmap bitmap = BitmapFactory.decodeByteArray(art, 0, art.length);

        // Set the Bitmap as the ImageView's image
        img.setImageBitmap(bitmap);

        Log.d("MediaInfo", "Album art found and set to ImageView");
      }

      String title = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_TITLE);
      String artist = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST);
      String album = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM);
      String duration = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
      Log.d("MediaInfo", "Title: " + title);
      Log.d("MediaInfo", "Artist: " + artist);
      Log.d("MediaInfo", "Album: " + album);

    } catch (Exception ignore) {
      Log.d("MediaInfo", "err" + ignore.getMessage());
    }