Chap6 - Earthquake not updating when nothing matches preferences
I noticed that if I select a minimum magnitude that does not return any quakes, the list of quakes displayed is not updated.
The arrayList earthquakes is cleared in refreshEarthquakes(), but the ArrayAdapter aa.notifyDataSetChanged is not being called in addNewQuake() since the condition regarding minmum magnitude does not satisfy.
I got around the problem by shifting the aa.notifyDataSetChanged() to the end of refreshEarthquakes() instead. That way the ArrayAdapter gets notified everytime there is a "refresh".
Is there a better way to do this?
|