question: private Favorite packFavorite ( Cursor c ) { Favorite favorite = new Favorite ( ) ; favorite . id = c . getLong ( ID_INDEX ) ; favorite . screen = c . getInt ( SCREEN_INDEX ) ; favorite . container = c . getInt ( CONTAINER_INDEX ) ; favorite . cellX = c . getInt ( CELLX_INDEX ) ; favorite . cellY = c . getInt ( CELLY_INDEX ) ; favorite . spanX = c . getInt ( SPANX_INDEX ) ; favorite . spanY = c . getInt ( SPANY_INDEX ) ; favorite . iconType = c . getInt ( ICON_TYPE_INDEX ) ; if ( favorite . iconType == Favorites . ICON_TYPE_RESOURCE ) { String iconPackage = c . getString ( ICON_PACKAGE_INDEX ) ; if ( ! TextUtils . isEmpty ( iconPackage ) ) { favorite . iconPackage = iconPackage ; } String iconResource = c . getString ( ICON_RESOURCE_INDEX ) ; if ( ! TextUtils . isEmpty ( iconResource ) ) { favorite . iconResource = iconResource ; } } if ( favorite . iconType == Favorites . ICON_TYPE_BITMAP ) { byte [ ] blob = c . getBlob ( ICON_INDEX ) ; if ( blob != null && blob . length > 0 ) { favorite . icon = blob ; } } String title = c . getString ( TITLE_INDEX ) ; if ( ! TextUtils . isEmpty ( title ) ) { favorite . title = title ; } String intentDescription = c . getString ( INTENT_INDEX ) ; if ( ! TextUtils . isEmpty ( intentDescription ) ) { try { Intent intent = Intent . parseUri ( intentDescription , 0 ) ; intent . removeExtra ( ItemInfo . EXTRA_PROFILE ) ; favorite . intent = intent . toUri ( 0 ) ; } catch ( URISyntaxException e ) { Log . e ( TAG , "Invalid intent" , e ) ; } } favorite . itemType = c . getInt ( ITEM_TYPE_INDEX ) ; if ( favorite . itemType == Favorites . ITEM_TYPE_APPWIDGET ) { favorite . appWidgetId = c . getInt ( APPWIDGET_ID_INDEX ) ; String appWidgetProvider = c . getString ( APPWIDGET_PROVIDER_INDEX ) ; if ( ! TextUtils . isEmpty ( appWidgetProvider ) ) { favorite . appWidgetProvider = appWidgetProvider ; } } return favorite ; }
target:  Serialize a Favorite for persistence, including a checksum wrapper. 