How can I know that some text contain \"http://www.\" I want to show domain in Web View. Domain name is written in TextView but there is no restriction to add prefix. If user di
just modified @silwar answer and add https :
if(!url.startsWith("www.")&& !url.startsWith("http://") && !url.startsWith("https://")){
url = "www."+url;
}
if(!url.startsWith("http://") && !url.startsWith("https://")){
url = "http://"+url;
}
But remember it that sometimes http://
create security exception in android so we should use https://
.So for risk-free code, we have to do that like the last checking -
if(!url.startsWith("http://") && !url.startsWith("https://")){
url = "https://"+url;}