TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead
<p>Always getting this warning <strong>TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.</strong> and not finishing Activity for First time. On Second time not getting an warning and activity finishing perfectly.</p>

<p><strong>activity_login.xml</strong></p>

<pre><code>&lt;LinearLayout
        android:id="@+id/ll_login_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:gravity="center_horizontal"
        android:orientation="vertical"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:visibility="visible"&gt;


        &lt;android.support.design.widget.TextInputLayout
            android:id="@+id/email_field"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="16dp"
            android:hint="@string/email_phone"
            android:paddingTop="48dp"&gt;

            &lt;android.support.v7.widget.AppCompatEditText
                android:id="@+id/et_email"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:inputType="textEmailAddress"
                android:paddingEnd="0dp"
                android:paddingStart="8dp" /&gt;

        &lt;/android.support.design.widget.TextInputLayout&gt;

        &lt;android.support.design.widget.TextInputLayout
            android:id="@+id/password_field"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/password"
            android:paddingBottom="16dp"&gt;

            &lt;android.support.v7.widget.AppCompatEditText
                android:id="@+id/et_password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:inputType="textPassword"
                android:paddingEnd="0dp"
                android:paddingStart="8dp" /&gt;

        &lt;/android.support.design.widget.TextInputLayout&gt;


        &lt;Button
            android:id="@+id/btn_login"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginEnd="@dimen/button_login_social_margin"
            android:layout_marginStart="@dimen/button_login_social_margin"
            android:layout_marginBottom="@dimen/activity_vertical_margin"
            android:text="@string/login"
            android:textColor="@android:color/black" /&gt;

    &lt;/LinearLayout&gt;
</code></pre>

<p><strong>LoginActivity.java</strong></p>

<pre><code>    public class LoginActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        final AppCompatEditText etEmailOrPh = (AppCompatEditText) findViewById(R.id.et_email);
        final AppCompatEditText etPassword = (AppCompatEditText) findViewById(R.id.et_password);
        final Button btnLogin = (Button) findViewById(R.id.btn_login);

        assert etEmailOrPh != null;
        assert etPassword != null;
        assert  btnLogin != null;

        btnLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String emailOrPhone = etEmailOrPh.getText().toString().trim();
                String password = etPassword.getText().toString().trim();

                if(emailOrPhone.isEmpty()){
                    etEmailOrPh.setError(getResources().getString(R.string.email_phone_mandatory));
                    etEmailOrPh.requestFocus();
                } else if(emailOrPhone.contains("@") &amp;&amp; CommonUtil.isValidEmail(emailOrPhone)) {
                    etEmailOrPh.setError(getResources().getString(R.string.email_error));
                    etEmailOrPh.requestFocus();
                } else if(password.isEmpty()) {
                    etPassword.setError(getResources().getString(R.string.password_mandatory));
                    etPassword.requestFocus();
                } else {
                    SharedPreferences cache = LoginActivity.this.getSharedPreferences(Constants.SHARED_PREF_NAME, Context.MODE_PRIVATE);
                    final SharedPreferences.Editor preferenceEditor = cache.edit();
                    preferenceEditor.putInt(Constants.SHARED_PREF_ITEM_USER_ID, 1);
                    preferenceEditor.apply();
                    setResult(RESULT_OK);
                    finish();
                }
            }
        });

    }
}
</code></pre>

<p><a href="https://i.stack.imgur.com/WwzvXm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WwzvXm.png" alt="Login Screen"></a></p>