public static Uri formatURL(String url){
  if (url.startsWith("//")) {
    url="https:" + url;
  }
  if (url.startsWith("/")) {
    url="https://reddit.com" + url;
  }
  if (!url.contains("://")) {
    url="http://" + url;
  }
  Uri uri=Uri.parse(url);
  return uri.normalizeScheme();
}

public static Uri formatURL ( String url ) { if ( url . startsWith ( "//" ) ) { url = "https:" + url ; } if ( url . startsWith ( "/" ) ) { url = "https://reddit.com" + url ; } if ( ! url . contains ( "://" ) ) { url = "http://" + url ; } Uri uri = Uri . parse ( url ) ; return uri . normalizeScheme ( ) ; }
corrects mistakes users might make when typing urls , e . g . case sensitivity in the scheme and converts to uri
