Android examples for java.net:URL
is string a Valid Url
import android.text.TextUtils; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Random; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static boolean isValidUrl(String url) { String strPattern = "^(http|https)://(.+)/(.+)([.]+)(.+)$"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(url); return m.matches(); }/*from w w w . ja v a 2s .c o m*/ }