Skip to content

Instantly share code, notes, and snippets.

@spp
Created June 2, 2010 17:05
Show Gist options
  • Save spp/422674 to your computer and use it in GitHub Desktop.
Save spp/422674 to your computer and use it in GitHub Desktop.
// Creating a new Item
PlaylistItem pi = new PlaylistItem(mContext);
pi.title = "Discophrenia"
pi.desc = "This is a rather long description"
pi.author = "Brad Slyde"
if(pi.save){
// Saved successfully
}
else {
// Error!
}
// Playlist with id = 12
try{
PlaylistItem pi2 = PlaylistItem.find(mContext, 12)
}
catch (Exception e) {
// Could not find PlaylistItem with id 12
}
// Edit any playlist item
pi2.title = "A new title"
pi2.author = "Brad Slyde Jr"
pi2.save
// To delete
pi2.delete()
// Get all PlaylistItems
Cursor c = PlaylistItem.all(mContext, "title ASC", "10")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment