List of usage examples for android.widget RemoteViews setTextViewText
public void setTextViewText(int viewId, CharSequence text)
From source file:br.com.viniciuscr.notification2android.mediaPlayer.MediaPlaybackService.java
private void updateNotification() { RemoteViews views = new RemoteViews(getPackageName(), R.layout.statusbar); views.setImageViewResource(R.id.icon, R.drawable.stat_notify_musicplayer); if (getAudioId() < 0) { // streaming views.setTextViewText(R.id.trackname, getPath()); views.setTextViewText(R.id.artistalbum, null); } else {//from ww w .j ava 2 s .com String artist = getArtistName(); views.setTextViewText(R.id.trackname, getTrackName()); if (artist == null || artist.equals(MediaStore.UNKNOWN_STRING)) { artist = getString(R.string.unknown_artist_name); } String album = getAlbumName(); if (album == null || album.equals(MediaStore.UNKNOWN_STRING)) { album = getString(R.string.unknown_album_name); } views.setTextViewText(R.id.artistalbum, getString(R.string.notification_artist_album, artist, album)); } Notification status = new Notification(); status.contentView = views; status.flags |= Notification.FLAG_ONGOING_EVENT; status.icon = R.drawable.stat_notify_musicplayer; status.contentIntent = PendingIntent.getActivity(this, 0, new Intent("com.android.music.PLAYBACK_VIEWER").addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0); startForeground(PLAYBACKSERVICE_STATUS, status); }
From source file:android.app.Notification.java
/** * Sets the {@link #contentView} field to be a view with the standard "Latest Event" * layout.//from ww w . j a v a 2 s.c o m * * <p>Uses the {@link #icon} and {@link #when} fields to set the icon and time fields * in the view.</p> * @param context The context for your application / activity. * @param contentTitle The title that goes in the expanded entry. * @param contentText The text that goes in the expanded entry. * @param contentIntent The intent to launch when the user clicks the expanded notification. * If this is an activity, it must include the * {@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK} flag, which requires * that you take care of task management as described in the * <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back * Stack</a> document. * * @deprecated Use {@link Builder} instead. */ @Deprecated public void setLatestEventInfo(Context context, CharSequence contentTitle, CharSequence contentText, PendingIntent contentIntent) { // TODO: rewrite this to use Builder RemoteViews contentView = new RemoteViews(context.getPackageName(), R.layout.notification_template_base); if (this.icon != 0) { contentView.setImageViewResource(R.id.icon, this.icon); } if (priority < PRIORITY_LOW) { contentView.setInt(R.id.icon, "setBackgroundResource", R.drawable.notification_template_icon_low_bg); contentView.setInt(R.id.status_bar_latest_event_content, "setBackgroundResource", R.drawable.notification_bg_low); } if (contentTitle != null) { contentView.setTextViewText(R.id.title, contentTitle); } if (contentText != null) { contentView.setTextViewText(R.id.text, contentText); } if (this.when != 0) { contentView.setViewVisibility(R.id.time, View.VISIBLE); contentView.setLong(R.id.time, "setTime", when); } if (this.number != 0) { NumberFormat f = NumberFormat.getIntegerInstance(); contentView.setTextViewText(R.id.info, f.format(this.number)); } this.contentView = contentView; this.contentIntent = contentIntent; }
From source file:ua.mkh.weather.MainActivity.java
private void create_notif() { // TODO Auto-generated method stub // Prepare intent which is triggered if the // notification is selected String tittle = textView3.getText().toString(); String subject = textView3.getText().toString(); String body = ""; /*/* w w w. j a v a2s. c om*/ NotificationManager notif=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); Notification notify=new Notification((Integer)img1.getTag(),tittle,System.currentTimeMillis()); PendingIntent pending= PendingIntent.getActivity(getApplicationContext(), 0, new Intent(), 0); notify.setLatestEventInfo(getApplicationContext(),subject,body,pending); notif.notify(0, notify); final NotificationManager mgr= (NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE); Notification note=new Notification((Integer)img1.getTag(), "", System.currentTimeMillis()); // This pending intent will open after notification click PendingIntent i=PendingIntent.getActivity(this, 0, new Intent(), 0); note.setLatestEventInfo(this, tittle, "", i); //After uncomment this line you will see number of notification arrived //note.number=2; mgr.notify(1, note); PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0); Resources r = getResources(); Notification notification = new NotificationCompat.Builder(this) .setTicker("Tiket") .setSmallIcon(android.R.drawable.ic_menu_report_image) .setContentTitle("Title") .setContentText("Context Text") .setContentIntent(pi) .setAutoCancel(true) .build(); NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(0, notification); */ RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.widget); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher).setContent(remoteViews); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(this, MainActivity.class); // The stack builder object will contain an artificial back stack for // the // started Activity. // This ensures that navigating backward from the Activity leads out of // your application to the Home screen. TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); // Adds the back stack for the Intent (but not the Intent itself) stackBuilder.addParentStack(MainActivity.class); // Adds the Intent that starts the Activity to the top of the stack stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setOnClickPendingIntent(R.id.button1, resultPendingIntent); remoteViews.setTextViewText(R.id.textView1, nnn); remoteViews.setTextColor(R.id.textView1, getResources().getColor(R.color.white)); remoteViews.setImageViewResource(R.id.imageView1, (Integer) img1.getTag()); NotificationManager mNotificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); // mId allows you to update the notification later on. mNotificationManager.notify(100, mBuilder.build()); }
From source file:com.andrew.apolloMod.service.ApolloService.java
public RemoteViews getNotificationViewApi8() { RemoteViews views = new RemoteViews(getPackageName(), R.layout.status_bar_old); Bitmap b = getAlbumBitmap();/*from ww w . j a v a 2 s . c o m*/ if (b != null) { views.setViewVisibility(R.id.icon, View.VISIBLE); views.setImageViewBitmap(R.id.icon, b); } else { views.setViewVisibility(R.id.icon, View.GONE); } if (getAudioId() < 0) { // streaming views.setTextViewText(R.id.trackname, getPath()); views.setTextViewText(R.id.artistalbum, null); } else { String artist = getArtistName(); String album = getAlbumName(); views.setTextViewText(R.id.trackname, getTrackName()); views.setTextViewText(R.id.artistalbum, artist + " - " + album); } return views; }
From source file:net.sourceforge.servestream.service.MediaPlaybackService.java
private void setupExpandedContentView(RemoteViews rv, boolean updateNotification) { String trackName = getTrackName(); if (trackName == null || trackName.equals(Media.UNKNOWN_STRING)) { trackName = getMediaUri();//from w w w . ja v a 2 s . c o m } String artist = getArtistName(); if (artist == null || artist.equals(Media.UNKNOWN_STRING)) { artist = getString(R.string.unknown_artist_name); } String album = getAlbumName(); if (updateNotification) { if (isPlaying()) { rv.setImageViewResource(R.id.play_pause, android.R.drawable.ic_media_pause); } else { rv.setImageViewResource(R.id.play_pause, android.R.drawable.ic_media_play); } } else { rv.setImageViewResource(R.id.play_pause, android.R.drawable.ic_media_pause); } int trackId = getTrackId(); if (mPreferences.getBoolean(PreferenceConstants.RETRIEVE_ALBUM_ART, false) && trackId != -1) { Bitmap bitmap = getAlbumArt(true); if (bitmap != null) { rv.setImageViewBitmap(R.id.coverart, bitmap); } } // set the text for the notifications rv.setTextViewText(R.id.firstLine, trackName); rv.setTextViewText(R.id.secondLine, album); rv.setTextViewText(R.id.thirdLine, artist); rv.setOnClickPendingIntent(R.id.prev, createPendingIntent(1, CMDPREVIOUS)); rv.setOnClickPendingIntent(R.id.play_pause, createPendingIntent(2, CMDTOGGLEPAUSE)); rv.setOnClickPendingIntent(R.id.next, createPendingIntent(3, CMDNEXT)); rv.setOnClickPendingIntent(R.id.close, createPendingIntent(4, CMDSTOP)); }
From source file:com.wm.remusic.service.MediaService.java
private Notification getNotification() { RemoteViews remoteViews; final int PAUSE_FLAG = 0x1; final int NEXT_FLAG = 0x2; final int STOP_FLAG = 0x3; final String albumName = getAlbumName(); final String artistName = getArtistName(); final boolean isPlaying = isPlaying(); remoteViews = new RemoteViews(this.getPackageName(), R.layout.notification); String text = TextUtils.isEmpty(albumName) ? artistName : artistName + " - " + albumName; remoteViews.setTextViewText(R.id.title, getTrackName()); remoteViews.setTextViewText(R.id.text, text); //action? ?flag?? Intent pauseIntent = new Intent(TOGGLEPAUSE_ACTION); pauseIntent.putExtra("FLAG", PAUSE_FLAG); PendingIntent pausePIntent = PendingIntent.getBroadcast(this, 0, pauseIntent, 0); remoteViews.setImageViewResource(R.id.iv_pause, isPlaying ? R.drawable.note_btn_pause : R.drawable.note_btn_play); remoteViews.setOnClickPendingIntent(R.id.iv_pause, pausePIntent); Intent nextIntent = new Intent(NEXT_ACTION); nextIntent.putExtra("FLAG", NEXT_FLAG); PendingIntent nextPIntent = PendingIntent.getBroadcast(this, 0, nextIntent, 0); remoteViews.setOnClickPendingIntent(R.id.iv_next, nextPIntent); Intent preIntent = new Intent(STOP_ACTION); preIntent.putExtra("FLAG", STOP_FLAG); PendingIntent prePIntent = PendingIntent.getBroadcast(this, 0, preIntent, 0); remoteViews.setOnClickPendingIntent(R.id.iv_stop, prePIntent); // PendingIntent pendingIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, // new Intent(this.getApplicationContext(), PlayingActivity.class), PendingIntent.FLAG_UPDATE_CURRENT); final Intent nowPlayingIntent = new Intent(); //nowPlayingIntent.setAction("com.wm.remusic.LAUNCH_NOW_PLAYING_ACTION"); nowPlayingIntent/*from w w w .j ava 2 s . c o m*/ .setComponent(new ComponentName("com.wm.remusic", "com.wm.remusic.activity.PlayingActivity")); nowPlayingIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent clickIntent = PendingIntent.getBroadcast(this, 0, nowPlayingIntent, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent click = PendingIntent.getActivity(this, 0, nowPlayingIntent, PendingIntent.FLAG_UPDATE_CURRENT); final Bitmap bitmap = ImageUtils.getArtworkQuick(this, getAlbumId(), 160, 160); if (bitmap != null) { remoteViews.setImageViewBitmap(R.id.image, bitmap); // remoteViews.setImageViewUri(R.id.image, MusicUtils.getAlbumUri(this, getAudioId())); mNoBit = null; } else if (!isTrackLocal()) { if (mNoBit != null) { remoteViews.setImageViewBitmap(R.id.image, mNoBit); mNoBit = null; } else { Uri uri = null; if (getAlbumPath() != null) { try { uri = Uri.parse(getAlbumPath()); } catch (Exception e) { e.printStackTrace(); } } if (getAlbumPath() == null || uri == null) { mNoBit = BitmapFactory.decodeResource(getResources(), R.drawable.placeholder_disk_210); updateNotification(); } else { ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri) .setProgressiveRenderingEnabled(true).build(); ImagePipeline imagePipeline = Fresco.getImagePipeline(); DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline .fetchDecodedImage(imageRequest, MediaService.this); dataSource.subscribe(new BaseBitmapDataSubscriber() { @Override public void onNewResultImpl(@Nullable Bitmap bitmap) { // You can use the bitmap in only limited ways // No need to do any cleanup. if (bitmap != null) { mNoBit = bitmap; } updateNotification(); } @Override public void onFailureImpl(DataSource dataSource) { // No cleanup required here. mNoBit = BitmapFactory.decodeResource(getResources(), R.drawable.placeholder_disk_210); updateNotification(); } }, CallerThreadExecutor.getInstance()); } } } else { remoteViews.setImageViewResource(R.id.image, R.drawable.placeholder_disk_210); } if (mNotificationPostTime == 0) { mNotificationPostTime = System.currentTimeMillis(); } if (mNotification == null) { NotificationCompat.Builder builder = new NotificationCompat.Builder(this).setContent(remoteViews) .setSmallIcon(R.drawable.ic_notification).setContentIntent(click) .setWhen(mNotificationPostTime); if (CommonUtils.isJellyBeanMR1()) { builder.setShowWhen(false); } mNotification = builder.build(); } else { mNotification.contentView = remoteViews; } return mNotification; }
From source file:com.cloud9.netmusic.service.MediaService.java
private Notification getNotification() { RemoteViews remoteViews; final int PAUSE_FLAG = 0x1; final int NEXT_FLAG = 0x2; final int STOP_FLAG = 0x3; final String albumName = getAlbumName(); final String artistName = getArtistName(); final boolean isPlaying = isPlaying(); remoteViews = new RemoteViews(this.getPackageName(), R.layout.notification); String text = TextUtils.isEmpty(albumName) ? artistName : artistName + " - " + albumName; remoteViews.setTextViewText(R.id.title, getTrackName()); remoteViews.setTextViewText(R.id.text, text); //action? ?flag?? Intent pauseIntent = new Intent(TOGGLEPAUSE_ACTION); pauseIntent.putExtra("FLAG", PAUSE_FLAG); PendingIntent pausePIntent = PendingIntent.getBroadcast(this, 0, pauseIntent, 0); remoteViews.setImageViewResource(R.id.iv_pause, isPlaying ? R.drawable.note_btn_pause : R.drawable.note_btn_play); remoteViews.setOnClickPendingIntent(R.id.iv_pause, pausePIntent); Intent nextIntent = new Intent(NEXT_ACTION); nextIntent.putExtra("FLAG", NEXT_FLAG); PendingIntent nextPIntent = PendingIntent.getBroadcast(this, 0, nextIntent, 0); remoteViews.setOnClickPendingIntent(R.id.iv_next, nextPIntent); Intent preIntent = new Intent(STOP_ACTION); preIntent.putExtra("FLAG", STOP_FLAG); PendingIntent prePIntent = PendingIntent.getBroadcast(this, 0, preIntent, 0); remoteViews.setOnClickPendingIntent(R.id.iv_stop, prePIntent); // PendingIntent pendingIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, // new Intent(this.getApplicationContext(), PlayingActivity.class), PendingIntent.FLAG_UPDATE_CURRENT); final Intent nowPlayingIntent = new Intent(); //nowPlayingIntent.setAction("com.cloud9.netmusic.LAUNCH_NOW_PLAYING_ACTION"); nowPlayingIntent.setComponent(new ComponentName("com.wm.remusic", "PlayingActivity")); nowPlayingIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent clickIntent = PendingIntent.getBroadcast(this, 0, nowPlayingIntent, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent click = PendingIntent.getActivity(this, 0, nowPlayingIntent, PendingIntent.FLAG_UPDATE_CURRENT); final Bitmap bitmap = ImageUtils.getArtworkQuick(this, getAlbumId(), 160, 160); if (bitmap != null) { remoteViews.setImageViewBitmap(R.id.image, bitmap); // remoteViews.setImageViewUri(R.id.image, MusicUtils.getAlbumUri(this, getAudioId())); mNoBit = null;/*from w w w . ja va 2 s . c om*/ } else if (!isTrackLocal()) { if (mNoBit != null) { remoteViews.setImageViewBitmap(R.id.image, mNoBit); mNoBit = null; } else { Uri uri = null; if (getAlbumPath() != null) { try { uri = Uri.parse(getAlbumPath()); } catch (Exception e) { e.printStackTrace(); } } if (getAlbumPath() == null || uri == null) { mNoBit = BitmapFactory.decodeResource(getResources(), R.drawable.placeholder_disk_210); updateNotification(); } else { ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri) .setProgressiveRenderingEnabled(true).build(); ImagePipeline imagePipeline = Fresco.getImagePipeline(); DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline .fetchDecodedImage(imageRequest, MediaService.this); dataSource.subscribe(new BaseBitmapDataSubscriber() { @Override public void onNewResultImpl(@Nullable Bitmap bitmap) { // You can use the bitmap in only limited ways // No need to do any cleanup. if (bitmap != null) { mNoBit = bitmap; } updateNotification(); } @Override public void onFailureImpl(DataSource dataSource) { // No cleanup required here. mNoBit = BitmapFactory.decodeResource(getResources(), R.drawable.placeholder_disk_210); updateNotification(); } }, CallerThreadExecutor.getInstance()); } } } else { remoteViews.setImageViewResource(R.id.image, R.drawable.placeholder_disk_210); } if (mNotificationPostTime == 0) { mNotificationPostTime = System.currentTimeMillis(); } if (mNotification == null) { NotificationCompat.Builder builder = new NotificationCompat.Builder(this).setContent(remoteViews) .setSmallIcon(R.drawable.ic_notification).setContentIntent(click) .setWhen(mNotificationPostTime); if (CommonUtils.isJellyBeanMR1()) { builder.setShowWhen(false); } mNotification = builder.build(); } else { mNotification.contentView = remoteViews; } return mNotification; }
From source file:com.av.remusic.service.MediaService.java
private Notification getNotification() { RemoteViews remoteViews; final int PAUSE_FLAG = 0x1; final int NEXT_FLAG = 0x2; final int STOP_FLAG = 0x3; final String albumName = getAlbumName(); final String artistName = getArtistName(); final boolean isPlaying = isPlaying(); remoteViews = new RemoteViews(this.getPackageName(), R.layout.notification); String text = TextUtils.isEmpty(albumName) ? artistName : artistName + " - " + albumName; remoteViews.setTextViewText(R.id.title, getTrackName()); remoteViews.setTextViewText(R.id.text, text); //action? ?flag?? Intent pauseIntent = new Intent(TOGGLEPAUSE_ACTION); pauseIntent.putExtra("FLAG", PAUSE_FLAG); PendingIntent pausePIntent = PendingIntent.getBroadcast(this, 0, pauseIntent, 0); remoteViews.setImageViewResource(R.id.iv_pause, isPlaying ? R.drawable.note_btn_pause : R.drawable.note_btn_play); remoteViews.setOnClickPendingIntent(R.id.iv_pause, pausePIntent); Intent nextIntent = new Intent(NEXT_ACTION); nextIntent.putExtra("FLAG", NEXT_FLAG); PendingIntent nextPIntent = PendingIntent.getBroadcast(this, 0, nextIntent, 0); remoteViews.setOnClickPendingIntent(R.id.iv_next, nextPIntent); Intent preIntent = new Intent(STOP_ACTION); preIntent.putExtra("FLAG", STOP_FLAG); PendingIntent prePIntent = PendingIntent.getBroadcast(this, 0, preIntent, 0); remoteViews.setOnClickPendingIntent(R.id.iv_stop, prePIntent); // PendingIntent pendingIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, // new Intent(this.getApplicationContext(), PlayingActivity.class), PendingIntent.FLAG_UPDATE_CURRENT); final Intent nowPlayingIntent = new Intent(); //nowPlayingIntent.setAction("com.av.remusic.LAUNCH_NOW_PLAYING_ACTION"); nowPlayingIntent//from w ww . j a v a 2s.co m .setComponent(new ComponentName("com.av.remusic", "com.av.remusic.activity.PlayingActivity")); nowPlayingIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent clickIntent = PendingIntent.getBroadcast(this, 0, nowPlayingIntent, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent click = PendingIntent.getActivity(this, 0, nowPlayingIntent, PendingIntent.FLAG_UPDATE_CURRENT); final Bitmap bitmap = ImageUtils.getArtworkQuick(this, getAlbumId(), 160, 160); if (bitmap != null) { remoteViews.setImageViewBitmap(R.id.image, bitmap); // remoteViews.setImageViewUri(R.id.image, MusicUtils.getAlbumUri(this, getAudioId())); mNoBit = null; } else if (!isTrackLocal()) { if (mNoBit != null) { remoteViews.setImageViewBitmap(R.id.image, mNoBit); mNoBit = null; } else { Uri uri = null; if (getAlbumPath() != null) { try { uri = Uri.parse(getAlbumPath()); } catch (Exception e) { e.printStackTrace(); } } if (getAlbumPath() == null || uri == null) { mNoBit = BitmapFactory.decodeResource(getResources(), R.drawable.placeholder_disk_210); updateNotification(); } else { ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(uri) .setProgressiveRenderingEnabled(true).build(); ImagePipeline imagePipeline = Fresco.getImagePipeline(); DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline .fetchDecodedImage(imageRequest, MediaService.this); dataSource.subscribe(new BaseBitmapDataSubscriber() { @Override public void onNewResultImpl(@Nullable Bitmap bitmap) { // You can use the bitmap in only limited ways // No need to do any cleanup. if (bitmap != null) { mNoBit = bitmap; } updateNotification(); } @Override public void onFailureImpl(DataSource dataSource) { // No cleanup required here. mNoBit = BitmapFactory.decodeResource(getResources(), R.drawable.placeholder_disk_210); updateNotification(); } }, CallerThreadExecutor.getInstance()); } } } else { remoteViews.setImageViewResource(R.id.image, R.drawable.placeholder_disk_210); } if (mNotificationPostTime == 0) { mNotificationPostTime = System.currentTimeMillis(); } if (mNotification == null) { NotificationCompat.Builder builder = new NotificationCompat.Builder(this).setContent(remoteViews) .setSmallIcon(R.drawable.ic_notification).setContentIntent(click) .setWhen(mNotificationPostTime); if (CommonUtils.isJellyBeanMR1()) { builder.setShowWhen(false); } mNotification = builder.build(); } else { mNotification.contentView = remoteViews; } return mNotification; }
From source file:net.sourceforge.servestream.service.MediaPlaybackService.java
private void setupContentView(RemoteViews rv, boolean updateNotification) { String contentText;/*from w ww.j a v a 2 s . co m*/ String trackName = getTrackName(); if (trackName == null || trackName.equals(Media.UNKNOWN_STRING)) { trackName = getMediaUri(); } String artist = getArtistName(); if (artist == null || artist.equals(Media.UNKNOWN_STRING)) { artist = getString(R.string.unknown_artist_name); } String album = getAlbumName(); if (album == null || album.equals(Media.UNKNOWN_STRING)) { contentText = getString(R.string.notification_alt_info, artist); } else { contentText = getString(R.string.notification_artist_album, artist, album); } if (updateNotification) { if (isPlaying()) { rv.setImageViewResource(R.id.play_pause, android.R.drawable.ic_media_pause); } else { rv.setImageViewResource(R.id.play_pause, android.R.drawable.ic_media_play); } } else { rv.setImageViewResource(R.id.play_pause, android.R.drawable.ic_media_pause); } int trackId = getTrackId(); if (mPreferences.getBoolean(PreferenceConstants.RETRIEVE_ALBUM_ART, false) && trackId != -1) { Bitmap bitmap = getAlbumArt(true); if (bitmap != null) { rv.setImageViewBitmap(R.id.coverart, bitmap); } } // set the text for the notifications rv.setTextViewText(R.id.title, trackName); rv.setTextViewText(R.id.subtitle, contentText); rv.setOnClickPendingIntent(R.id.play_pause, createPendingIntent(2, CMDTOGGLEPAUSE)); rv.setOnClickPendingIntent(R.id.next, createPendingIntent(3, CMDNEXT)); rv.setOnClickPendingIntent(R.id.close, createPendingIntent(4, CMDSTOP)); }