p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Android 2 Application Development (http://p2p.wrox.com/forumdisplay.php?f=547)
-   -   Deleting An Earthquake Record (http://p2p.wrox.com/showthread.php?t=82902)

braisj March 9th, 2011 11:08 PM

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:

(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.


All times are GMT -4. The time now is 08:56 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.