Example usage for android.provider MediaStore UNKNOWN_STRING

List of usage examples for android.provider MediaStore UNKNOWN_STRING

Introduction

In this page you can find the example usage for android.provider MediaStore UNKNOWN_STRING.

Prototype

String UNKNOWN_STRING

To view the source code for android.provider MediaStore UNKNOWN_STRING.

Click Source Link

Document

The string that is used when a media attribute is not known.

Usage

From source file:com.android.app.MediaPlaybackActivity.java

private void updateTrackInfo() {
    if (mService == null) {
        return;//from   ww  w .j a  va2  s .c o m
    }
    try {
        String path = mService.getPath();
        if (path == null) {
            finish();
            return;
        }

        long songid = mService.getAudioId();
        if (songid < 0 && path.toLowerCase().startsWith("http://")) {
            // Once we can get album art and meta data from MediaPlayer, we
            // can show that info again when streaming.
            ((View) mArtistName.getParent()).setVisibility(View.INVISIBLE);
            ((View) mAlbumName.getParent()).setVisibility(View.INVISIBLE);
            mAlbum.setVisibility(View.GONE);
            mTrackName.setText(path);
            mTitlePlaying.setText(path);
            mAlbumArtHandler.removeMessages(GET_ALBUM_ART);
            mAlbumArtHandler.obtainMessage(GET_ALBUM_ART, new AlbumSongIdWrapper(-1, -1)).sendToTarget();
        } else {
            ((View) mArtistName.getParent()).setVisibility(View.VISIBLE);
            ((View) mAlbumName.getParent()).setVisibility(View.VISIBLE);
            String artistName = mService.getArtistName();
            if (MediaStore.UNKNOWN_STRING.equals(artistName)) {
                artistName = getString(R.string.unknown_artist_name);
            }
            mArtistName.setText(artistName);
            String albumName = mService.getAlbumName();
            long albumid = mService.getAlbumId();
            if (MediaStore.UNKNOWN_STRING.equals(albumName)) {
                albumName = getString(R.string.unknown_album_name);
                albumid = -1;
            }
            mAlbumName.setText(albumName);
            mTrackName.setText(mService.getTrackName());
            mTitlePlaying.setText(mService.getTrackName());
            mAlbumArtHandler.removeMessages(GET_ALBUM_ART);
            mAlbumArtHandler.obtainMessage(GET_ALBUM_ART, new AlbumSongIdWrapper(albumid, songid))
                    .sendToTarget();
            mAlbum.setVisibility(View.VISIBLE);
        }
        mDuration = mService.duration();
        mTotalTime.setText(MusicUtils.makeTimeString(this, mDuration / 1000));
    } catch (RemoteException ex) {
        finish();
    }
}