Home Forum
Welcome, Guest
Username Password: Remember me

Delete / Update records in android sqlite
(1 viewing) (1) Guest
Discussion related to creating Android software
  • Page:
  • 1

TOPIC: Delete / Update records in android sqlite

Delete / Update records in android sqlite 2 years, 9 months ago #168

Using sqlite via content providers provides an easy way to reference records uniquely on a per table basis, android (somewhere) adds a primary key (_id) to each table you create, this means that each query can return an ID, this can be used to delete and update records by simply appending the id to the content uri.

Like this, assume ID = '1'

 
getContentResolver().delete(
Uri.withAppendedPath(CONTENT_URI,"1"),
null,null);
 


What I am curious about is, is this ID reliable to use across sessions, is it added by Android or SQLite? It seems to work but I haven't been able to find any documentation on this.
  • marvin
  • OFFLINE
  • Professor
  • Posts: 18
  • Karma: 0
Last Edit: 2 years, 8 months ago by admin.
  • Page:
  • 1
Time to create page: 0.21 seconds
Copyright © 2012 Android Academy. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.
 
Glossary
We have 28 guests online