0

android.view.InflateException: Binary XML file line #32: Binary XML file line #32: Error inflating class < unknown >

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try{
        setContentView(R.layout.installation_dialog);//error occured at this line.

this is my xml file

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.CardView
    android:id="@+id/card_view"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginTop="@dimen/activity_horizontal_margin"
    android:layout_marginBottom="@dimen/activity_horizontal_margin"
    android:layout_marginLeft="@dimen/activity_custom_margin"
    android:layout_marginRight="@dimen/activity_custom_margin"
    android:layout_weight="0.54"
    card_view:cardElevation="@dimen/cardview_default_elevation"
    card_view:contentPadding="10dp">


    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">


        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1">

            <android.support.design.widget.TextInputLayout
                android:id="@+id/input_layout_Insta_Activities"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="5dp"
                android:layout_weight="1">

                <EditText
                    android:id="@+id/etInstaActivities"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:hint="Activity Name"
                    android:textColorHint="@color/accent"
                    android:textColor="@color/black"
                    />

            </android.support.design.widget.TextInputLayout>

        </TableRow>
        <TableRow
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            >
            <Spinner
                android:id="@+id/SpInstaStatus"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="0.7" />
            <android.support.design.widget.TextInputLayout
                android:id="@+id/input_layout_InstaSpentHrs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="0.3">

                <EditText
                    android:id="@+id/etInstaSpentHrs"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="0.3"
                    android:editable="false"
                    android:focusable="false"
                    android:hint="Spent Hrs"
                    android:textColor="@android:color/black"
                    android:theme="@style/AutocompleteTheme" />
            </android.support.design.widget.TextInputLayout>
        </TableRow>

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1">

            <android.support.design.widget.TextInputLayout
                android:id="@+id/input_layout_InstaReason"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/LLHrs"
                android:layout_marginTop="10dp"
                android:layout_weight="1">

                <EditText
                    android:id="@+id/edReworkReason"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:ems="11"
                    android:hint="Reason for Rework"
                    android:inputType="textMultiLine"
                    android:theme="@style/AutocompleteTheme" />
            </android.support.design.widget.TextInputLayout>
        </TableRow>

        <TableRow
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:layout_weight="1">

            <Button
                android:id="@+id/btn_instal_ok"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_weight="0.5"
                android:gravity="center"
                android:text="@string/OK"
                android:textColor="@color/white"
                android:theme="@style/CustomButtonStyle"/>

            <Button
                android:id="@+id/btn_instal_cancel"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="0.5"
                android:text="@string/Cancel"
                android:textColor="@color/white"
                android:theme="@style/CustomButtonStyle"/>
        </TableRow>
    </TableLayout>

</android.support.v7.widget.CardView>
</RelativeLayout>

I have seen some examples on it, and I have tried those solutions. But I did not solve it.I have studied the solution in this link, but did not resolve the issue

Any one can help me.

3
  • please check your support design gradle version Commented Jan 4, 2018 at 13:41
  • compile 'com.android.support:design:27.0.2'@farhana Commented Jan 5, 2018 at 4:15
  • @kalyan You are not using weight properly...check here how to use weight in your views developer.android.com/guide/topics/ui/layout/linear.html Commented Jan 5, 2018 at 5:27

2 Answers 2

0

You should use android.support.design.widget.TextInputEditText as child of android.support.design.widget.TextInputLayout according to documentation.

It will look like:

 <android.support.design.widget.TextInputLayout
            android:id="@+id/input_layout_InstaReason"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/LLHrs"
            android:layout_marginTop="10dp"
            android:layout_weight="1">

            <android.support.design.widget.TextInputEditText
                android:id="@+id/edReworkReason"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ems="11"
                android:hint="Reason for Rework"
                android:inputType="textMultiLine"
                android:theme="@style/AutocompleteTheme" />
        </android.support.design.widget.TextInputLayout>
Sign up to request clarification or add additional context in comments.

1 Comment

It is not a problem @maheryhaja
0

Please check your build.gradle file in which you are adding below line or not:

compile 'com.android.support:design:27.0.2' // version is depends on your sdk download.

hope this is your issue and if not then please comment below post i will help you to solved your error.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.