protected VideoDTO extractOneVideoFromCursor(Cursor cursor){
  if (videoIdCol == -1) {
    videoIdCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media._ID);
    videoTitleCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.TITLE);
    videoDisplayNameCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DISPLAY_NAME);
    videoDescriptionCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DESCRIPTION);
    videoBucketIdCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.BUCKET_ID);
    videoBucketDisplayNameCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.BUCKET_DISPLAY_NAME);
    videoDataCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
    videoMimeCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.MIME_TYPE);
    videoResolutionCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.RESOLUTION);
    videoSizeCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.SIZE);
    videoDateAddedCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATE_ADDED);
    videoDateTakenCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATE_TAKEN);
    videoDateModifyCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATE_MODIFIED);
    videoLatitudeCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.LATITUDE);
    videoLongitudeCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.LONGITUDE);
    videoAlbumCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.ALBUM);
    videoArtistCol=cursor.getColumnIndexOrThrow(MediaStore.Video.Media.ARTIST);
  }
  VideoDTO video=new VideoDTO();
  video.setId(cursor.getLong(videoIdCol));
  video.setTitle(cursor.getString(videoTitleCol));
  video.setDisplayName(cursor.getString(videoDisplayNameCol));
  video.setDescription(cursor.getString(videoDescriptionCol));
  video.setBucketId(cursor.getString(videoBucketIdCol));
  video.setBucketDisplayName(cursor.getString(videoBucketDisplayNameCol));
  video.setUri(cursor.getString(videoDataCol));
  video.setMimeType(cursor.getString(videoMimeCol));
  video.setSize(cursor.getLong(videoSizeCol));
  video.setAddedDate(new Date(cursor.getLong(videoDateAddedCol)));
  video.setTakenDate(new Date(cursor.getLong(videoDateTakenCol)));
  video.setModifyDate(new Date(cursor.getLong(videoDateModifyCol)));
  video.setLatitude(cursor.getDouble(videoLatitudeCol));
  video.setLongitude(cursor.getDouble(videoLongitudeCol));
  video.setAlbum(cursor.getString(videoAlbumCol));
  video.setArtist(cursor.getString(videoArtistCol));
  String resolution=cursor.getString(videoResolutionCol);
  if (resolution != null) {
    try {
      String[] res=resolution.split("x");
      int width=Integer.parseInt(res[0]);
      int height=Integer.parseInt(res[1]);
      video.setWidth(width);
      video.setHeight(height);
    }
 catch (    Exception e) {
      Log.w(TAG,String.format("Failed to parse resolution of video(id=%d, title=%s, displayName=%s)",video.getId(),video.getTitle(),video.getDisplayName()),e);
    }
  }
  return video;
}

protected VideoDTO extractOneVideoFromCursor ( Cursor cursor ) { if ( videoIdCol == - 1 ) { videoIdCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . _ID ) ; videoTitleCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . TITLE ) ; videoDisplayNameCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . DISPLAY_NAME ) ; videoDescriptionCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . DESCRIPTION ) ; videoBucketIdCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . BUCKET_ID ) ; videoBucketDisplayNameCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . BUCKET_DISPLAY_NAME ) ; videoDataCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . DATA ) ; videoMimeCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . MIME_TYPE ) ; videoResolutionCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . RESOLUTION ) ; videoSizeCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . SIZE ) ; videoDateAddedCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . DATE_ADDED ) ; videoDateTakenCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . DATE_TAKEN ) ; videoDateModifyCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . DATE_MODIFIED ) ; videoLatitudeCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . LATITUDE ) ; videoLongitudeCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . LONGITUDE ) ; videoAlbumCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . ALBUM ) ; videoArtistCol = cursor . getColumnIndexOrThrow ( MediaStore . Video . Media . ARTIST ) ; } VideoDTO video = new VideoDTO ( ) ; video . setId ( cursor . getLong ( videoIdCol ) ) ; video . setTitle ( cursor . getString ( videoTitleCol ) ) ; video . setDisplayName ( cursor . getString ( videoDisplayNameCol ) ) ; video . setDescription ( cursor . getString ( videoDescriptionCol ) ) ; video . setBucketId ( cursor . getString ( videoBucketIdCol ) ) ; video . setBucketDisplayName ( cursor . getString ( videoBucketDisplayNameCol ) ) ; video . setUri ( cursor . getString ( videoDataCol ) ) ; video . setMimeType ( cursor . getString ( videoMimeCol ) ) ; video . setSize ( cursor . getLong ( videoSizeCol ) ) ; video . setAddedDate ( new Date ( cursor . getLong ( videoDateAddedCol ) ) ) ; video . setTakenDate ( new Date ( cursor . getLong ( videoDateTakenCol ) ) ) ; video . setModifyDate ( new Date ( cursor . getLong ( videoDateModifyCol ) ) ) ; video . setLatitude ( cursor . getDouble ( videoLatitudeCol ) ) ; video . setLongitude ( cursor . getDouble ( videoLongitudeCol ) ) ; video . setAlbum ( cursor . getString ( videoAlbumCol ) ) ; video . setArtist ( cursor . getString ( videoArtistCol ) ) ; String resolution = cursor . getString ( videoResolutionCol ) ; if ( resolution != null ) { try { String [ ] res = resolution . split ( "x" ) ; int width = Integer . parseInt ( res [ 0 ] ) ; int height = Integer . parseInt ( res [ 1 ] ) ; video . setWidth ( width ) ; video . setHeight ( height ) ; } catch ( Exception e ) { Log . w ( TAG , String . format ( "Failed to parse resolution of video(id=%d, title=%s, displayName=%s)" , video . getId ( ) , video . getTitle ( ) , video . getDisplayName ( ) ) , e ) ; } } return video ; }
extract one videodto from the given cursor from its current position
