Created
June 2, 2010 17:05
-
-
Save spp/422674 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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