• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

TextInputLayout crashes

What does the logcat say? Post the logcat.

You'll probably need to post more code than that so that anyone can help you.
 
As above, the problem is impossible to diagnose from the information given.
Need to see the Logcat, with stack trace. And more of the code.
 
Java:
Java:
private TextInputLayout TextInputName;
private EditText name;

CODE without errors...

TextInputName=findViewById(R.id.register_textinput_name1);

CODE without errors...

String stringName=name.getText().toString().trim();
       
if (stringName.isEmpty()){
   TextInputName.setError("Enter your name");
} 

CODE without errors...

Xml:
Code:
            <android.support.design.widget.TextInputLayout
                android:id="@+id/register_textinput_name1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/register_textview_title"
                android:layout_marginTop="30dp"
                android:layout_marginStart="20dp"
                android:layout_marginEnd="20dp"

                android:background="@drawable/background_textinput"
                android:paddingLeft="4dp"
                android:paddingRight="4dp"
                android:paddingTop="10dp"
                android:paddingBottom="4dp"
                android:theme="@style/TextInput"
                app:errorEnabled="true">
                <android.support.design.widget.TextInputEditText
                    android:id="@+id/register_textinput_name2"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="8dp"
                    android:layout_marginRight="8dp"

                    android:inputType="textPersonName"
                    android:hint="Nombre"
                    android:textColor="@color/colorWhite"
                    android:textColorHint="@color/colorWhite"
                    android:shadowColor="@color/colorWhite"
                    android:textColorLink="@color/colorWhite"
                    android:textColorHighlight="@color/colorWhite"
                    android:textSize="14dp"/>
            </android.support.design.widget.TextInputLayout>


styles.xml:
Code:
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="TextInput" parent="TextAppearance.AppCompat">
        <item name="colorAccent">@color/colorWhite</item>
        <item name="colorControlNormal">@color/colorWhite</item>
        <item name="colorControlActivated">@color/colorWhite</item>
        <item name="textColorError">@color/colorWhite</item>
    </style>
</resources>

Logcat:
Code:
03-31 23:06:34.560 13199-13199/com.example.fdesia.app E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.fdesia.app, PID: 13199
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fdesia.app/com.example.fdesia.app.RegisterActivity}: android.view.InflateException: Binary XML file line #69: Binary XML file line #69: Error inflating class android.support.design.widget.TextInputLayout
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3319)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
        at android.app.ActivityThread.access$1100(ActivityThread.java:229)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:7406)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
     Caused by: android.view.InflateException: Binary XML file line #69: Binary XML file line #69: Error inflating class android.support.design.widget.TextInputLayout
        at android.view.LayoutInflater.inflate(LayoutInflater.java:551)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
        at com.example.fdesia.app.RegisterActivity.onCreate(RegisterActivity.java:36)
        at android.app.Activity.performCreate(Activity.java:6904)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415) 
        at android.app.ActivityThread.access$1100(ActivityThread.java:229) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.app.ActivityThread.main(ActivityThread.java:7406) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
     Caused by: android.view.InflateException: Binary XML file line #69: Error inflating class android.support.design.widget.TextInputLayout
        at android.view.LayoutInflater.createView(LayoutInflater.java:657)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:847)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:855)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:855)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:527)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
        at com.example.fdesia.app.RegisterActivity.onCreate(RegisterActivity.java:36) 
        at android.app.Activity.performCreate(Activity.java:6904) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415) 
        at android.app.ActivityThread.access$1100(ActivityThread.java:229) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.app.ActivityThread.main(ActivityThread.java:7406) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at android.view.LayoutInflater.createView(LayoutInflater.java:631)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
        at com.example.fdesia.app.RegisterActivity.onCreate(RegisterActivity.java:36) 
        at android.app.Activity.performCreate(Activity.java:6904) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415) 
        at android.app.ActivityThread.access$1100(ActivityThread.java:229) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.app.ActivityThread.main(ActivityThread.java:7406) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) 
     Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 24: TypedValue{t=0x3/d=0x1a6 "res/color/secondary_text_material_light.xml" a=1 r=0x10601e9}
        at android.content.res.TypedArray.getColor(TypedArray.java:449)
        at android.widget.TextView.<init>(TextView.java:1036)
        at android.widget.TextView.<init>(TextView.java:957)
        at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:76)
        at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:72)
        at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:68)
        at android.support.design.widget.TextInputLayout.setErrorEnabled(TextInputLayout.java:628)
        at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:257)
        at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:187)
        at java.lang.reflect.Constructor.newInstance(Native Method) 
        at android.view.LayoutInflater.createView(LayoutInflater.java:631) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:847) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:855) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:810) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:527) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139) 
        at com.example.fdesia.app.RegisterActivity.onCreate(RegisterActivity.java:36) 
        at android.app.Activity.performCreate(Activity.java:6904) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3266) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415) 
        at android.app.ActivityThread.access$1100(ActivityThread.java:229) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:148) 
        at android.app.ActivityThread.main(ActivityThread.java:7406) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
 
Caused by: android.view.InflateException: Binary XML file line #69: Binary XML file line #69: Error inflating class android.support.design.widget.TextInputLayout


There's a problem in your layout file at line 69. So you need to show the entire contents of your XML layout file, rather than a small fragment, so we can see what's at line 69.

Seems to be a problem with a missing resource

Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 24: TypedValue{t=0x3/d=0x1a6 "res/color/secondary_text_material_light.xml" a=1 r=0x10601e9}
 
Actually I am a newbie in Code. I thought that he actually didn't getting text from a Text view which he is finding in this code.
TextInputName=findViewById(R.id.register_textinput_name1);
So I thought this code solve his problem
 
Actually I am a newbie in Code. I thought that he actually didn't getting text from a Text view which he is finding in this code.
TextInputName=findViewById(R.id.register_textinput_name1);
So I thought this code solve his problem

Thanks for the input, but let's not confuse the issue. The stack trace from the Logcat is your first clue to diagnose the problem. But we do need to see a full and complete XML layout file, to match up the line number shown in the stack trace.
 
Back
Top Bottom