Join David Gassner for an in-depth discussion in this video Deleting data from database tables, part of Android SDK: Local Data Storage.
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 item.…And if we didn't come from My Tours, then we'll show the Add Item.…
- Exploring local data storage options
- Creating an Android virtual device
- Starting a new project
- Defining preferences with Java and activities
- Creating and reading JSON and XML data files
- Creating a new SQLite database
- Inserting and retrieving data in the database
Skill Level Intermediate
1. Getting Started
2. Using Application Preferences
3. Using Internal and External File Storage
4. Working with SQLite Databases
5. Managing and Displaying SQLite Data
Improving the data display9m 29s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.