valid EditText input for URL String - Android User Interface

Android examples for User Interface:EditText

Description

valid EditText input for URL String

Demo Code


//package com.java2s;
import android.widget.EditText;

public class Main {
    public static String valid(EditText mEditText) {
        String http = "http://";
        String https = "https://";

        String textEdit = mEditText.getText().toString();
        if (textEdit.contains(http) && textEdit.contains(https)) {
            return textEdit;
        }//from w  ww. ja  v a2  s.  c  o m

        else
            return http + textEdit;

    }
}

Related Tutorials