public void sortByAlbum() {
   mItems.clear();
   for (ListItem album : mSeparatorItemMap.values()) {
     mItems.add(album);
     Collections.sort(album.mMediaList, MediaComparators.byTrackNumber);
     for (Media media : album.mMediaList) add(media.getTitle(), null, media);
   }
 }
 public static void setPicture(Context context, Media m, Bitmap p) {
   Log.d(TAG, "Setting new picture for " + m.getTitle());
   try {
     MediaDatabase.getInstance(context)
         .updateMedia(m.getLocation(), MediaDatabase.mediaColumn.MEDIA_PICTURE, p);
   } catch (SQLiteFullException e) {
     Log.d(TAG, "SQLiteFullException while setting picture");
   }
   m.setPictureParsed(true);
 }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    View view = convertView;
    if (view == null) {
      LayoutInflater inflater =
          (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      view = inflater.inflate(android.R.layout.simple_list_item_1, parent, false);
      holder = new ViewHolder();
      holder.text = (TextView) view.findViewById(android.R.id.text1);
      view.setTag(holder);
    } else holder = (ViewHolder) view.getTag();

    Media item = getItem(position);
    holder.text.setText(item.getTitle());

    return view;
  }
  private void updateList() {
    if (mediaList == null) return;

    mAlbumsAdapter.clear();
    mSongsAdapter.clear();

    Collections.sort(mediaList, MediaComparators.byAlbum);
    String lastAlbumName = new String();

    for (int i = 0; i < mediaList.size(); ++i) {
      Media media = mediaList.get(i);
      mAlbumsAdapter.add(media.getAlbum(), null, media);

      if (!lastAlbumName.equals(media.getAlbum())) {
        mSongsAdapter.addSeparator(media.getAlbum());
        lastAlbumName = media.getAlbum();
      }
      mSongsAdapter.add(media.getTitle(), null, media);
    }
  }
 @Override
 public int compare(Media object1, Media object2) {
   return object1.getTitle().compareToIgnoreCase(object2.getTitle());
 }