Example usage for android.support.v4.media MediaMetadataCompat getText

List of usage examples for android.support.v4.media MediaMetadataCompat getText

Introduction

In this page you can find the example usage for android.support.v4.media MediaMetadataCompat getText.

Prototype

public CharSequence getText(@TextKey String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.mylovemhz.simplay.MediaControlFragment.java

private void readMetadata(MediaMetadataCompat metadata) {
    if (metadata != null) {
        seekBar.setMax((int) metadata.getLong(MediaMetadataCompat.METADATA_KEY_DURATION));
        artistText.setText(metadata.getText(MediaMetadataCompat.METADATA_KEY_ALBUM_ARTIST));
        titleText.setText(metadata.getText(MediaMetadataCompat.METADATA_KEY_TITLE));
        String artUrl = metadata.getText(MediaMetadataCompat.METADATA_KEY_ALBUM_ART_URI).toString();
        try {// w w w. j  a  va2  s  .  co  m
            Picasso.with(getContext().getApplicationContext()).load(artUrl).into(albumImage);
        } catch (IllegalArgumentException e) {
            //no artwork
            albumImage.setImageResource(R.drawable.ic_album);
        }
    }
}