Code example for URLConnection

Methods: getInputStream, getOutputStream, setDoOutput

0
		new GraphImageDownloadWatchTask(this, retryGraphDownloadArea).execute();
		try { 
 
			URL urltest = new URL("http://chart.apis.google.com/chart");
			URLConnection urlConnection = urltest.openConnection();
			urlConnection.setDoOutput(true);
 
			OutputStreamWriter outputStreamWriter = new OutputStreamWriter(urlConnection.getOutputStream());
			BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);
			bufferedWriter.write(url);
			bufferedWriter.close();
			outputStreamWriter.close();
 
			final InputStream inputStream = urlConnection.getInputStream();
			bt = BitmapFactory.decodeStream(inputStream);
			inputStream.close();
			//	InputStream inputStream = new URL(url).openStream(); 
			//			bt = BitmapFactory.decodeStream(inputStream); 
 
		} catch (MalformedURLException e) {
			//Log.e(TAG, "MalformedURLException グラフ画像取得中にエラー", e);