public boolean highlightCurrentTrack() { // Purpose is to highlight a track in the tracks fragment if it is currently // playing in the mediaplayer sevice. if ((mCursor == null) || (mCursor.getCount() == 0)) return false; int numTracks = mCursor.getCount(); // Check to see if we are connected to the media player service. // Also see if the current artist in tracks fragment is the same as one loaded // in the service and make sure that if we compare, that we don't // have a different number of tracks numbers in service than in tracks fragment if ((mService != null) && mArtistID.equals(mService.getArtistID()) && (numTracks > 0) && (numTracks == mService.getNumTracks())) { mCursor.moveToPosition(mService.getCurrentTrack()); if ((mCursor.getString(COL_TRACKS_PREVIEW_URL).equals(mService.getPreviewUrl()))) { if (mTracksListView != null) { mPosition = mCursor.getPosition(); mTracksListView.setItemChecked(mPosition, true); return true; } } } return false; }