如何在Android中编码一个url? 我用如下方法实现:
final String encodedURL = URLEncoder.encode(urlAsString, "UTF-8");
URL url = new URL(encodedURL);
但是用上面的代码后,urlAsString
中的http://
被encodedURL
中的http%3A%2F%2F
代替,然后当我使用url
时获得一个java.net.MalformedURLException
错误提醒。请求大家帮忙解答,万分感谢。