Code example for AtomicInteger

Methods: decrementAndGet, incrementAndGet

0
	protected Bitmap doInBackground(Void... params) {
		if(isCancelled()) {
			return null; 
		}		 
		try { 
			Log.d(TAG, "Task count=" + counter.incrementAndGet());
			return ImageUtils.loadCropBounds(path, resultWidth, resultHeight);
		} 
		finally { 
			counter.decrementAndGet();
		} 
	} 
	 
	@Override 
	protected void onPostExecute(Bitmap bitmap) {
		if(isCancelled()) {
			bitmap = null;
		} 
		if(imageViewRef!=null && bitmap!=null) {
			final ImageView imageView = imageViewRef.get();
			final BitmapLoaderTask imageTask = getBitmapLoaderTask(imageView);