Code example for Gallery

Methods: getSelectedItemPosition

0
	imageSwitcher = (ImageSwitcher) urls[1];
	originalPosition = (Integer) urls[2];
	Picture picture = (Picture) urls[3];
	Bitmap downloadImage = null;
	// make sure the user is watching the picture 
	if (originalPosition == gallery.getSelectedItemPosition()) {
	    try { 
		File imageFileOnExternalDirectory = FileUtils.getInstance().getFileFromGallery(activity,
			picture.getFileName(), picture.getForceExtension(), fileUrl, true,
			((RegalAndroidApplication) activity.getApplication()).getCurrentAlbum().getName());
		downloadImage = BitmapFactory.decodeFile(imageFileOnExternalDirectory.getPath());
		picture.setResizedImageCachePath(imageFileOnExternalDirectory.getPath());
 
	    } catch (GalleryConnectionException e) {
		logger.debug(e.getMessage());
	    } catch (FileHandlingException e) {
		logger.debug(e.getMessage());
	    } 
	} 
	return downloadImage;
    }