@Override
 public void onPause() {
   super.onPause();
   if (mediaSource != null) {
     mediaSource.getSource().removeListener(this);
   }
 }
 @Override
 public void onResume() {
   super.onResume();
   if (mediaSource != null) {
     mediaSource.getSource().addListener(this);
     onSourceDataChanged();
     onSourceStateChanged();
   }
 }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    if (peerType == PeerType.PEER_CHAT) {
      getSherlockActivity()
          .getSupportActionBar()
          .setTitle(highlightTitleText(R.string.st_media_title_group));
    } else if (peerType == PeerType.PEER_USER) {
      getSherlockActivity()
          .getSupportActionBar()
          .setTitle(highlightTitleText(R.string.st_media_title_user));
    } else {
      getSherlockActivity()
          .getSupportActionBar()
          .setTitle(highlightTitleText(R.string.st_media_title_all));
    }
    getSherlockActivity().getSupportActionBar().setSubtitle(null);
    getSherlockActivity().getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSherlockActivity().getSupportActionBar().setDisplayShowHomeEnabled(false);
  }
 @Override
 public void onConfigurationChanged(Configuration newConfig) {
   super.onConfigurationChanged(newConfig);
   updateOrientation();
 }
 @Override
 public void onDestroyView() {
   super.onDestroyView();
   gridView = null;
 }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putInt("peerType", peerType);
   outState.putInt("peerId", peerId);
 }