Shouldn't notifyDataSetChanged() be inside the `if' ?
Code:
private void addNewQuake(Quake _quake) {
Earthquake earthquakeActivity = (Earthquake)getActivity();
if (_quake.getMagnitude() > earthquakeActivity.minimumMagnitude) {
// Add the new quake to our list of earthquakes.
earthquakes.add(_quake);
}
// Notify the array adapter of a change.
aa.notifyDataSetChanged();
}
As you can see here, aa.notiftyDataSetChanged() is called every time the addNewQuake is called, independently if the quake is added or not. Is that OK ?
Also, in refreshEarthquakes, the list is cleared without notifying the adapter:
Code:
// Clear the old earthquakes
earthquakes.clear();
This seems an error to me, isn't it ?