@Override
  public void onListItemClick(ListView listView, View view, int position, long id) {
    super.onListItemClick(listView, view, position, id);

    // Notify the active callbacks interface (the activity, if the
    // fragment is attached to one) that an item has been selected
    dao.close();
    Song song = (Song) listView.getItemAtPosition(position);
    mCallbacks.onItemSelected(String.valueOf(song.getId()));
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    dao = new TroubDAO(this.getActivity());
    try {
      dao.open();
    } catch (SQLException e) {
      String error = "Unable to open TroubDAO" + e.getStackTrace();
      Log.e(SongListFragment.class.getName(), error);
    }

    List<Song> songs = dao.getAllSongs();

    // use the SimpleCursorAdapter to show the
    // elements in a ListView
    ArrayAdapter<Song> adapter =
        new ArrayAdapter<Song>(this.getActivity(), android.R.layout.simple_list_item_1, songs);
    setListAdapter(adapter);
    setHasOptionsMenu(true);
  }
 public void onDialogPositiveClick(NewSongDialogFragment dialog) {
   Song song = dao.createSong(dialog.title);
   // ArrayAdapter<Song> list = (ArrayAdapter<Song>)getListAdapter();
   // list.add(song);
   mCallbacks.onItemSelected(String.valueOf(song.getId()));
 }