Code example for URI

Methods: toURL

			try { 
				// Use built in functions of url to convert url string to html 
				// encoded version 
				url = new URL(urlString);
				URI uri = new URI(url.getProtocol(), url.getUserInfo(),
						url.getHost(), url.getPort(), url.getPath(),
						url.getQuery(), url.getRef());
				url = uri.toURL();
				Log.d(DEBUG_TAG, "The current URL is: " + url.toString());
				// Open HttpURLConnection 
				httpConnection = (HttpURLConnection) url.openConnection();
				// Append authorization string to HTTP request header 
				if (!accessAuthenticated) {
					httpConnection.setRequestProperty("Authorization", "Basic "
							+ encoding);
					// accessAuthenticated = true; 
Connect your IDE to all the code out there  Get Codota for Java