Code example for URL

Methods: openConnection

0
 
		@Override 
		protected Bitmap doInBackground(Void... params) {
			InputStream is = null;
			try { 
				URL aURL = new URL(url);
				URLConnection conn = aURL.openConnection();
 
				conn.connect();
 
				is = new BufferedInputStream(conn.getInputStream());
 
				return BitmapFactory.decodeStream(is);
			} catch (IOException e) {
				AphidLog.e(e, "Failed to load bitmap from url: " + url);
			} finally { 
				IO.close(is);
			} 
 
			return null; 
		}