Delete Data From Android Sdk Database Tables
Deleting data from database tables
At this point, my tour finder application uses two tables, one for the primary tour data, and one for a mytours table that tracks tours that the user has selected and I can look at a filtered view showing just those tours. I'd like to add functionality to the application that lets the user remove an item from that custom list. I've added some code to the application so that when the user goes into an item from the mytours list, they now see a menu choice, REMOVE FROM MY TOURS .
I'll show you how I did that. First, I'll go the XML file, tour_detail.xml that you can find in the resource area's menu folder. I've added a second item to the menu. Its ID is menu_delete, and this string menu_delete equates to the string you see on the screen, Remove from My Tours. Then I added logic to TourDetailActivity.java. In the CreateOptionsMenu method shown here, I now have code that filters which menu item is selected.
If we came from the My Tours view, then we are going to show the delete ...
Building Mobile Apps with Google Maps Android API v2115,725 Views
Connecting Android Apps to RESTful Web Services147,811 Views
Distributing Android Apps (2014)49,038 Views
Building a Note-Taking App for Android (2013)224,476 Views
Building Adaptive Android Apps with Fragments103,400 Views
Illustrator CC 2013 One-on-One: Fundamentals1,676,368 Views
PHP with MySQL Essential Training4,259,922 Views