I would like to use intent.setData(Uri uri) to pass data obtained from a URL. In order to do this, I need to be able to create a Uri from a URL (or from a byte
I think your answer can be found from here..
Uri.Builder.build() works quite well with normal URLs, but it fails with port number support.
The easiest way that I discovered to make it support port numbers was to make it parse a given URL first then work with it.
Uri.Builder b = Uri.parse("http://www.yoursite.com:12345").buildUpon();
b.path("/path/to/something/");
b.appendQueryParameter("arg1", String.valueOf(42));
if (username != "") {
b.appendQueryParameter("username", username);
}
String url = b.build().toString();
Source : http://twigstechtips.blogspot.com/2011/01/android-create-url-using.html