コード例 #1
0
  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;
    }
  }
コード例 #2
0
ファイル: ImageLoader.java プロジェクト: Nairou/Subsonic
    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);
      }
    }