Kotlin Media Player: How to get the filename of a resource id (resid)?

63 Views Asked by At

I'm using the MediaPLayer to play the following mp3-file via the resid, e.g. 2131623940: Abstract of the code:

                if (mp == null) {
                    mp = MediaPlayer.create(this, 2131623940)
                    Log.d("MainActivity", "ID: ${mp!!.audioSessionId}")
                    initializeSeekBar()
                }

I can manually find the name of the resource file at R.raw.bb_einfuehrung --> As you can see, for the resid 2131623940 it is "bb_einfuehrung".

Question: How can I get, for each resid number, the corresponding resource file name? I found an answer on that for Java but not for Kotlin. Thank You very mich in andvance.

MediaPlayer.TrackInfo.MEDIA_TRACK_TYPE_AUDIO only returns a number, but not the name of the track.

0

There are 0 best solutions below