Code example for URL

Methods: openStream

0
			throws IOException { 
 
		if (uri.getScheme().equals("content"))
			return context.getContentResolver().openInputStream(uri);
		else if (uri.getScheme().equals("file")) {
			URL url = new URL(uri.toString());
 
			return url.openStream();
		} else { 
			HttpClient httpclient = new DefaultHttpClient();
			HttpGet httpget = new HttpGet(uri.toString());
			HttpResponse response = httpclient.execute(httpget);
			HttpEntity entity = response.getEntity();
			if (entity != null)
				return entity.getContent();
			else 
				throw new IOException("No HTTP response");
			// Use the regular java stuff 
			// URL url = new URL(uri.toString()); 
 
			// return url.openStream();