How to check given domain name http or https in java?

后端 未结 7 994
说谎
说谎 2021-01-11 10:48

My problem

In my android application I get url input from user, like \"www.google.com\".

I want to find out for the given url whether to use

7条回答
  •  半阙折子戏
    2021-01-11 11:33

    You can check, the given url is http or https by using URLUtils.

    URLUtil.isHttpUrl(String url); returns True if the url is an http.

    URLUtil.isHttpsUrl(String url); returns True if the url is an https.

提交回复
热议问题