Code example for ConcurrentModificationException

0
		return path;
	} 
	 
	public void setOnBitmapLoadedListener(OnBitmapLoadedListener listener) {
		if(Looper.getMainLooper().getThread()!=Thread.currentThread()) {
			throw new ConcurrentModificationException("Cannot set OnBitmapLoadedListener outside of main thread");
		} 
		onBitmapLoadedListener = listener;
	} 
	 
	public static BitmapLoaderTask createTaskOrCancel(Context context, String path, ImageView imageView, Bitmap placeholder, int width, int height) {
		if(context==null || imageView==null || placeholder==null) {
			return null; 
		} 
		if(cancelLoadTask(path, imageView)) {
			final BitmapLoaderTask task = new BitmapLoaderTask(path, imageView, width, height);
			final AsyncDrawable asyncDrawable = new AsyncDrawable(context.getResources(), placeholder, task);
			imageView.setImageDrawable(asyncDrawable);
			return task;
		} 
		return null;