private SearchResult search(String query) {
    MusicService musicService = MusicServiceFactory.getMusicService(getContext());
    if (musicService == null) {
      return null;
    }

    try {
      return musicService.search(new SearchCritera(query, 5, 10, 10), getContext(), null);
    } catch (Exception e) {
      return null;
    }
  }
Exemple #2
0
    public void loadImage() {
      try {
        MusicService musicService = MusicServiceFactory.getMusicService(mContext);
        Bitmap bitmap = musicService.getCoverArt(mContext, mEntry, mSize, null);
        String key = getKey(mEntry.getCoverArt(), mSize);
        cache.put(key, bitmap);
        // Make sure key is the most recently "used"
        cache.get(key);
        if (mIsNowPlaying) {
          nowPlaying = bitmap;
        }

        final Drawable drawable = Util.createDrawableFromBitmap(mContext, bitmap);
        mTaskHandler.setDrawable(drawable);
        mHandler.post(mTaskHandler);
      } catch (Throwable x) {
        Log.e(TAG, "Failed to download album art.", x);
      }
    }