Android edittext how we can know user entered either phone or email
<p>[login activity]</p>

<p>i am new to android app development.
i am developing android app.
user can login using email id or mobile no.like facebook login.
how we can know either user entered email or mobile.
please help me.
For validation is their any validation frame work in android api like password,email id mobile no pattern matcher etc please help me.</p>

<pre><code>&lt;EditText
    android:layout_width="wrap_content"
    android:layout_height="50dp"
    android:inputType="text"
    android:ems="10"
    android:id="@+id/etUserName"
    android:layout_marginTop="90dp"
    android:hint="Enter Email id/Mobile no"
    android:textColorHint="#4d060505"
    android:background="@drawable/edittext_bg"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_alignParentStart="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:gravity="center"&gt;
    &lt;requestFocus/&gt;
&lt;/EditText&gt;

&lt;EditText
    android:layout_width="wrap_content"
    android:layout_height="50dp"
    android:inputType="textPassword"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:ems="10"
    android:id="@+id/etPwd"
    android:hint="Password"
    android:textColorHint="#4d060505"
    android:layout_marginBottom="5dp"
    android:layout_marginTop="10dp"
    android:background="@drawable/edittext_bg"
    android:layout_below="@+id/etUserName"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:gravity="center"/&gt;
</code></pre>

<p>this code worked for me perfectly.
after your suggestions i tried it.</p>

<p><code>if(isEmailValid(loginname)){
            Toast.makeText(getApplicationContext(), "Email", Toast.LENGTH_LONG).show();
        }else if(isValidMobileNumber(loginname)){
            Toast.makeText(getApplicationContext(), "mobileNo", Toast.LENGTH_LONG).show();
        }else{
            Toast.makeText(getApplicationContext(), "Enter Email or Mobile No", Toast.LENGTH_LONG).show();
        }</code></p>