in Education by
I updated support lib version to 24.2.0 and my registration screen is dead now. The problem is in the TextInputLayout, I have two methods: protected void setError(@Nullable CharSequence errorMsg, @NonNull EditText editText, boolean forceClean) { TextInputLayout viewParent = (TextInputLayout) editText.getParent(); if (forceClean) { viewParent.setErrorEnabled(false); viewParent.setError(null); } viewParent.setErrorEnabled(true); viewParent.setError(errorMsg); } protected void clearError(@NonNull EditText editText) { TextInputLayout viewParent = (TextInputLayout) editText.getParent(); viewParent.setErrorEnabled(false); viewParent.setError(null); } I'm getting an error when I'm trying to cast the parent of EditText to TextInputLayout, in the layout I have this kind of code for that: So, this worked perfectly fine, but now it throws ClassCastException: java.lang.ClassCastException: android.widget.FrameLayout cannot be cast to android.support.design.widget.TextInputLayout I'm wondering if there some new guides on that? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
The problem investigation showed that there is extra layout for some reason, so now we have TextInputLayout -> FrameLayout -> TextInputEditText and that is sad :( so as temp workaround I've created following method: @Nullable private TextInputLayout getTextInputLayout(@NonNull EditText editText) { View currentView = editText; for (int i = 0; i < 2; i++) { ViewParent parent = currentView.getParent(); if (parent instanceof TextInputLayout) { return (TextInputLayout) parent; } else { currentView = (View) parent; } } return null; } This one will find your TextInputLayout in view hierarchy. If you the lucky one you will notice this pink error color change, the easy way to overcome it is override style, in styles.xml: @color/red

Related questions

0 votes
    I am using Smack in an Android app for XMPP based communication. I am trying to create a privacy ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    Consider the impedance function Y(s)=(s^2+4s+3)/(3s^2+18s+24). Find the value of R0 after realizing ... Questions for GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 12, 2021 in Education by JackTerrance
0 votes
    Consider the impedance function Y(s)=(s^2+4s+3)/(3s^2+18s+24). Find the value of R1 after realizing ... Questions for GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 12, 2021 in Education by JackTerrance
0 votes
    Consider the impedance function Y(s)=(s^2+4s+3)/(3s^2+18s+24). Find the value of C1 after realizing ... Questions for GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 12, 2021 in Education by JackTerrance
0 votes
    Consider the impedance function Y(s)=(s^2+4s+3)/(3s^2+18s+24). Find the value of R2 after realizing ... Questions for GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 12, 2021 in Education by JackTerrance
0 votes
    Consider the impedance function Y(s)=(s^2+4s+3)/(3s^2+18s+24). Find the value of C2 after realizing ... Questions for GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 12, 2021 in Education by JackTerrance
0 votes
    Find the probability of throwing at most 2 sixes in 6 throws of a single die. Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
0 votes
    In the context of computing, a byte is equal to _____ bits ? 1. 4 2. 16 3. 24 4. 8...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    I believe that i messed up with configuration but I cannot get where and how to fix it. Here you ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    I believe that i messed up with configuration but I cannot get where and how to fix it. Here you ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 4, 2022 in Education by JackTerrance
0 votes
    I looked at all the answers on StackOverflow and there no answer for me. Same error for ... and emulators. Fileprovider always throws IllegalArgumentException There is Manifest...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I looked at all the answers on StackOverflow and there no answer for me. Same error for ... and emulators. Fileprovider always throws IllegalArgumentException There is Manifest...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    ________ function is usually used inside another function and throws a warning whenever a particular package is not ... R Programming Select the correct answer from above options...
asked Feb 12, 2022 in Education by JackTerrance
...