I have an app to share YouTube videos. Edittext text must should be a link in this purpose. But the problem is that I don't know how to detect if it is a link or simple text. Let say I have an edittext with id edittext1. On button1 click i shall check if edittext consists of a link or not. Thanks in advance.
You can use URLUtil.isValidUrl(url) to check if a string is a valid URL.
P.S - Do note that there are many ways that a URL can be well-formed but not retrievable. It's always best to ensure that you're catching any potential exceptions that might be thrown even after you check if the URL is valid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With