public static URL stringToUrl(String urlString){
  URL url=null;
  try {
    url=new URL(urlString);
    final URI uri=new URI(url.getProtocol(),url.getUserInfo(),url.getHost(),url.getPort(),url.getPath(),url.getQuery(),url.getRef());
    url=uri.toURL();
  }
 catch (  Exception e) {
    try {
      url=new URL(urlString);
    }
 catch (    MalformedURLException e2) {
      Log.d("CHCP","Failed to transfer url string \"" + urlString + "\" to actual url",e2);
    }
  }
  return url;
}

public static URL stringToUrl ( String urlString ) { URL url = null ; try { url = new URL ( urlString ) ; final URI uri = new URI ( url . getProtocol ( ) , url . getUserInfo ( ) , url . getHost ( ) , url . getPort ( ) , url . getPath ( ) , url . getQuery ( ) , url . getRef ( ) ) ; url = uri . toURL ( ) ; } catch ( Exception e ) { try { url = new URL ( urlString ) ; } catch ( MalformedURLException e2 ) { Log . d ( "CHCP" , "Failed to transfer url string \"" + urlString + "\" to actual url" , e2 ) ; } } return url ; }
convert string representation of the url into url object .
