MediaMetadataCompat title item, how avoid clickable or browsing - Android Auto
Hi I am facing an issue using MediaMetadataCompat for Android Auto extension apps. I am trying to create a head title before the items, but that title has the click feautre active to browse or play and I do not the way to disable it, so I do not want it as clickable, only just as a header
val headerMediaItem = MediaMetadataCompat.Builder().apply {
putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, "HEADER_ID")
putString(MediaMetadataCompat.METADATA_KEY_TITLE, "Header items title")
flag = MediaBrowserCompat.MediaItem.FLAG_PLAYABLE // FLAG_BROWSABLE both are clickables
}.build()
I guess it must to be a way to create "dumb" items, not playable, not browsable, but I did not figured out.
Thanks in advance
To clarify, when setting the flags for the MediaBrowserCompat.MediaItem, the flag is indeed an integer, and by passing 0, you're explicitly stating that there should be no actions (neither FLAG_PLAYABLE nor FLAG_BROWSABLE):
val headerMediaItem = MediaMetadataCompat.Builder().apply {
putString(MediaMetadataCompat.METADATA_KEY_MEDIA_ID, "HEADER_ID")
putString(MediaMetadataCompat.METADATA_KEY_TITLE, "Header items title")
flag = 0 // no flags, making it non-clickable
}.build()
falg = 0 has no effect, it is clickable anyway
It seems that migrating to media3 there is an attribute to make it, but migrating now for me it is not a choice
Apologies, my mistake. I'll hand this over to @marcbaechinger, who is an expert in this area.
Hi @marcbaechinger any ideas on this one?
@marcbaechinger any thoughts on this one ?
Hi I finally solved it adding a extra with a flag from MediaConstants called
DESCRIPTION_EXTRAS_KEY_CONTENT_STYLE_GROUP_TITLE.
So adding it to a group of elements with a title, it is placed as a header with the proper stylement.