@Override public void onCreate(Bundle savedInstanceState) { // *POOF* super.onCreate(savedInstanceState); setContentView(R.layout.list_common); // Set title of activity setTitle("Albums"); Intent i = getIntent(); if (i.getIntExtra("artist_id", -1) != -1) { setTitle(i.getStringExtra("artist")); whereClause = "artist_id = " + i.getIntExtra("artist_id", -1); } // Get ListView widget ListView lv = (ListView) findViewById(R.id.list); lv.setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> l, View v, int position, long id) { onListItemClick((ListView) l, v, position, id); } }); // Instantiate ArrayAdapter aa = new AlbumAdapter(this, R.layout.list_item, albums); // Assign Adapter to ListView lv.setAdapter(aa); }
@Override protected void updateNowPlaying(Song currentSong, boolean animate) { super.updateNowPlaying(currentSong, animate); for (Album a : albums) { if (currentSong != null && a.getId() == currentSong.getAlbum_id()) { a.setPlaying(true); Log.d(getPackageName(), a.getTitle() + " found"); } else { a.setPlaying(false); } } aa.notifyDataSetChanged(); }