is String Http URL - Android java.net

Android examples for java.net:URL

Description

is String Http URL

Demo Code

import android.app.Activity;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.view.inputmethod.InputMethodManager;
import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static boolean isHttp(String mobiles) {
        Pattern p = Pattern
                .compile("^http://[\\w-\\.]+(?:/|(?:/[\\w\\.\\-]+)*(?:/[\\w\\.\\-]+\\.do))?$");
        Matcher m = p.matcher(mobiles);

        Pattern p1 = Pattern
                .compile("^https://[\\w-\\.]+(?:/|(?:/[\\w\\.\\-]+)*(?:/[\\w\\.\\-]+\\.do))?$");
        Matcher m1 = p1.matcher(mobiles);
        return m.matches() || m1.matches();
    }/*from  w  ww .j  a  v  a 2 s .com*/

}

Related Tutorials