Code example for URLConnection

Methods: connectgetInputStreamsetDoInput

0
	private Bitmap getBitmapFromWebURL(String src){
		try { 
			URLConnection urlConnection = null;
			URL url = new URL(src);
			urlConnection = url.openConnection();
			urlConnection.setDoInput(true);
			urlConnection.connect();
			InputStream input = urlConnection.getInputStream();
			return BitmapFactory.decodeStream(input);
			 
		} catch (IOException e) {
			Log.e(TAG, "io exception, when getting the bitmap from the url: "+ src);
			return null; 
		}		 
	} 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE