Problem to resolve Error Popup not displaying for EditText Android

Here i have a special case to show that error popup for Editext ,
I have multiple expandable/collapse rows and each row having that expireDateEdittext EditText.

After expanding the row , initially EditText will just have only error icon inside it and not has Error popup .After clicking on it Date picker dialog need to display.

Here in my case after expanding row Error icon displaying properly But problem is Error Popup not displaying after clicking and setting the wrong date on it.
So, I thought its EditText focus problem after expanding the row.And i have fixed that issue using following process.

XML File : 

 <EditText
                android:id="@+id/expireDateEdittext"
                style="@style/EditText"
                android:layout_width="fill_parent"
                android:layout_height="@dimen/expireDateEdittext_height"
                android:editable="false"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:clickable="true"
                android:ems="10"
                android:text="@string/expireDateEdittext_text"
                android:paddingLeft="10dp" />


Java File :
expireDateEdittext.setEnabled(true);
expireDateEdittext.setFocusableInTouchMode(true);

expireDateEdittext.setError(getResources().getString(R.string.expiryDateError));

if (expireDateEdittext.requestFocus()) {
 ((PopupWindow) getWindowToken()).setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}


Got Refrence from following Site :
http://www.androidhive.info/2015/09/android-material-design-floating-labels-for-edittext/

Comments

Popular posts from this blog

Custom Dialog with no title and full screen in Android

Best working code to set Date limits on Date Picker Dialog,in Android

code to display .pdf,.text,.DOC,.DOCX,.doc extension files exists in SDCard