Code example for URL

Methods: openStream

0
		} 
 
		private Bitmap downloadDrawable() {
			if (imageView == null) return null;
			try { 
				URL url = new URL(imageUrl);
				return BitmapFactory.decodeStream(url.openStream());
			} catch (IOException ex) {
				log.error("Downloading image failed: " + imageUrl, ex);
				return null; 
			} 
		} 
 
		@Override 
		protected void onPostExecute(Bitmap bitmap) {
			synchronized (getSyncObject()) { 
				log.debug("Download finished, updating image");
				if (imageView == null) return;
				if (imageView.getTag() != imageUrl) return;
				if (bitmap == null) return;
				imageView.setVisibility(View.VISIBLE);