1

I'm trying to open a URL containing a #, using this:

startActivity(new Intent("android.intent.action.VIEW", Uri.parse(url)));

But when browser opens, the # is ignored... I don't know why???

1 Answer 1

1

Try to construct the URL properly using URL class URL encoding in Android

String urlStr = "http://abc.dev.domain.com/0007AC/ads/800x480 15sec h.264.mp4";
URL url = new URL(urlStr);
URI uri = new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef());
url = uri.toURL();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.