Code example for AtomicReferenceArray

0
 
	private static class DownloadImagesTask extends 
			AsyncTask<String, Integer, Void> {
		private AsyncTaskLabActivity mActivity;
		private AtomicReferenceArray<Bitmap> mDownloadedBitmaps = new AtomicReferenceArray<Bitmap>(
				DOWNLOAD_URLS.length);
 
		public DownloadImagesTask(AsyncTaskLabActivity activity) {
			this.mActivity = activity;
		} 
 
		@Override 
		protected Void doInBackground(String... urls) {
			for (int i = 0; i < urls.length; i++) {
				if (!isCancelled()) {
					try { 
						Bitmap bitmap = BitmapFactory
								.decodeStream((InputStream) new URL(urls[i])
										.getContent());
						mDownloadedBitmaps.set(i, bitmap);
					} catch (MalformedURLException e) {