I am new to Android and I am working through Chapter 7. Everything is running smoothly; however, I am trying to figure out a way to delete a record from the earthquake database content provider. I know the methods for deleting rows is already written in the earthquakeProvider class, but my problem is I can't figure out how to implement that. I was thinking an onLongClickListener in the main activity that preforms the request.
Here is what I have so far:
(Earthquake.java)
Code:
earthquakeListView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView _av, View _v, int _index,
long arg3) {
ContentResolver cr = getContentResolver();
cr.delete(EarthquakeProvider.CONTENT_URI, selectedQuake, null);
return false;
}
});
This is not working and any help would be much appreciated.