View Single Post
  #1 (permalink)  
Old March 9th, 2011, 11:08 PM
braisj braisj is offline
Registered User
Join Date: Mar 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Deleting An Earthquake Record

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:

  earthquakeListView.setOnItemLongClickListener(new OnItemLongClickListener() {

	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.
Reply With Quote