1

Hi In the below code I am facing an issue with the following logcat error.

I am created one application which contains left navigation drawer .In that when we click on Help menu from drawer it is showing the below error with crashing the app.At the time of crashing I am getting the below error.

can any one please help me

Logcat:

 Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.constraint.Drawlayout
     Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.constraint.Drawlayout
     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.constraint.Drawlayout" on path: DexPathList[[zip file "/data/app/com.example

HelpActivity.java:

public class HelpActivity extends AppCompatActivity {



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_help);
        Mint.initAndStartSession(this.getApplication(), ConstantUtils.SPLUNK_MINK_KEY);

        DrawerLayout txtSendMail;
        DrawerLayout txtCall;
        DrawerLayout txtEmailFeedback;
        DrawerLayout txtWebsite;

        txtSendMail=(DrawerLayout)findViewById(R.id.txt_send_mail);
        txtCall=(DrawerLayout)findViewById(R.id.txt_call);
        txtEmailFeedback=(DrawerLayout)findViewById(R.id.txt_email_feedback);
        txtWebsite=(DrawerLayout)findViewById(R.id.txt_website);


        txtSendMail.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String toEmailAddress = "[email protected]";
                Intent email = new Intent(Intent.ACTION_SEND);
                email.putExtra(Intent.EXTRA_EMAIL, new String[]{ toEmailAddress });
                email.setType("message/rfc822");
                startActivity(Intent.createChooser(email, "Choose an Email client :"));
            }
        });
        txtEmailFeedback.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String toEmailAddress = "[email protected]";
                Intent email = new Intent(Intent.ACTION_SEND);
                email.putExtra(Intent.EXTRA_EMAIL, new String[]{ toEmailAddress });
                email.setType("message/rfc822");
                startActivity(Intent.createChooser(email, "Choose an Email client :"));
            }
        });
        txtCall.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String phoneNumnber = "tel:1800103131";
                Intent callIntent = new Intent(Intent.ACTION_DIAL);
                callIntent.setData(Uri.parse(phoneNumnber));
                startActivity(callIntent);
            }
        });
        txtWebsite.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Uri uri = Uri.parse("http://smart.havells.com");
                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                startActivity(intent);
            }
        });



    }




    public void BackToGeyser(View view) {

        final ImageView viewToAnimate = (ImageView) findViewById(R.id.back_arrow_to_geyser_id);

        Animation in = AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
        viewToAnimate.startAnimation(in);
        viewToAnimate.setVisibility(View.VISIBLE);

        onBackPressed();


    }

}

activity_help:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.Drawlayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/chipmonk_background">

    <RelativeLayout
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/toolbar_height"
        android:layout_gravity="center_vertical"
        android:background="@color/color_toolbar"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <RelativeLayout
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:layout_centerVertical="true"
            android:layout_marginStart="10dp"
            android:onClick="BackToGeyser">

            <ImageView
                android:id="@+id/back_arrow_to_geyser_id"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_marginStart="2dp"
                android:background="@drawable/ic_arrow_back"
                android:onClick="BackToGeyser" />
        </RelativeLayout>
        <!--
                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="25sp"
                    android:layout_marginTop="2sp">
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:background="@drawable/menu"/>
                </RelativeLayout>
        -->
        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:layout_gravity="center_horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:text="@string/help"
                android:textColor="@color/white"
                android:textSize="@dimen/heading_font_size" />

        </RelativeLayout>


    </RelativeLayout>

    <android.support.constraint.Guideline
        android:id="@+id/guideline20"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.75" />

    <android.support.constraint.Guideline
        android:id="@+id/guideline21"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.55" />

    <android.support.constraint.Guideline
        android:id="@+id/guideline22"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_percent="0.35" />

    <android.support.constraint.Guideline
        android:id="@+id/guideline23"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.12" />

    <android.support.constraint.Guideline
        android:id="@+id/guideline24"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.88" />

    <TextView
        android:id="@+id/textView33"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="@font/roboto_medium"
        android:text="24/7 Customer Support"
        android:textColor="@android:color/black"
        app:layout_constraintStart_toStartOf="@+id/guideline23"
        app:layout_constraintTop_toTopOf="@+id/guideline22" />

    <android.support.constraint.ConstraintLayout
        android:id="@+id/txt_send_mail"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginBottom="16dp"
        android:layout_marginEnd="24dp"
        android:layout_marginTop="8dp"
        android:background="@drawable/login_button_background"
        android:elevation="4dp"
        app:layout_constraintBottom_toTopOf="@+id/guideline21"
        app:layout_constraintDimensionRatio="w,1.5:1"
        app:layout_constraintEnd_toStartOf="@+id/txt_call"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintHorizontal_chainStyle="packed"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView33">

        <ImageView
            android:id="@+id/imageView9"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_marginTop="16dp"
            app:layout_constraintBottom_toTopOf="@+id/guideline25"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:srcCompat="@drawable/ic_message" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline25"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="0.55" />

        <TextView
            android:id="@+id/textView34"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:fontFamily="@font/roboto_medium"
            android:text="send an email"
            android:textAlignment="center"
            android:textAllCaps="true"
            android:textColor="@android:color/white"
            android:textSize="10sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/guideline25" />
    </android.support.constraint.ConstraintLayout>

    <android.support.constraint.ConstraintLayout
        android:id="@+id/txt_call"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginBottom="16dp"
        android:layout_marginTop="8dp"
        android:background="@drawable/login_button_background"
        android:elevation="4dp"
        app:layout_constraintBottom_toTopOf="@+id/guideline21"
        app:layout_constraintDimensionRatio="w,1.5:1"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toEndOf="@+id/txt_send_mail"
        app:layout_constraintTop_toBottomOf="@+id/textView33"
        app:layout_constraintVertical_bias="0.0">

        <ImageView
            android:id="@+id/imageView10"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_marginTop="16dp"
            app:layout_constraintBottom_toTopOf="@+id/guideline27"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:srcCompat="@drawable/ic_phone" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline27"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="0.55" />

        <TextView
            android:id="@+id/textView36"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:fontFamily="@font/roboto_medium"
            android:text="call us"
            android:textAlignment="center"
            android:textAllCaps="true"
            android:textColor="@android:color/white"
            android:textSize="10sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/guideline27" />
    </android.support.constraint.ConstraintLayout>

    <TextView
        android:id="@+id/textView38"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="4dp"
        android:fontFamily="@font/roboto_medium"
        android:text="Send feedback on Geyser App "
        android:textColor="@android:color/black"
        app:layout_constraintStart_toStartOf="@+id/guideline23"
        app:layout_constraintTop_toTopOf="@+id/guideline21" />

    <android.support.constraint.ConstraintLayout
        android:id="@+id/txt_email_feedback"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginBottom="16dp"
        android:layout_marginTop="8dp"
        android:background="@drawable/login_button_background"
        android:elevation="4dp"
        app:layout_constraintBottom_toTopOf="@+id/guideline20"
        app:layout_constraintDimensionRatio="h,1.5:1"
        app:layout_constraintEnd_toEndOf="@+id/txt_send_mail"
        app:layout_constraintStart_toStartOf="@+id/txt_send_mail"
        app:layout_constraintTop_toBottomOf="@+id/textView38">

        <ImageView
            android:id="@+id/imageView11"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_marginTop="16dp"
            app:layout_constraintBottom_toTopOf="@+id/guideline1"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:srcCompat="@drawable/ic_message" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="0.55" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:fontFamily="@font/roboto_medium"
            android:text="email us"
            android:textAlignment="center"
            android:textAllCaps="true"
            android:textColor="@android:color/white"
            android:textSize="10sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/guideline1" />
    </android.support.constraint.ConstraintLayout>

    <TextView
        android:id="@+id/textView39"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="@font/roboto_medium"
        android:text="For any further details"
        android:textColor="@android:color/black"
        app:layout_constraintStart_toStartOf="@+id/guideline23"
        app:layout_constraintTop_toTopOf="@+id/guideline20" />

    <android.support.constraint.ConstraintLayout
        android:id="@+id/txt_website"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginTop="8dp"
        android:background="@drawable/login_button_background"
        android:elevation="4dp"
        app:layout_constraintDimensionRatio="1.5:1"
        app:layout_constraintEnd_toEndOf="@+id/txt_send_mail"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="@+id/txt_send_mail"
        app:layout_constraintTop_toBottomOf="@+id/textView39">

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_marginTop="16dp"
            app:layout_constraintBottom_toTopOf="@+id/guideline2"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:srcCompat="@drawable/ic_web" />

        <android.support.constraint.Guideline
            android:id="@+id/guideline2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            app:layout_constraintGuide_percent="0.55" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:fontFamily="@font/roboto_medium"
            android:text="havells india ltd"
            android:textAlignment="center"
            android:textAllCaps="true"
            android:textColor="@android:color/white"
            android:textSize="10sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/guideline2" />
    </android.support.constraint.ConstraintLayout>

</android.support.constraint.Drawlayout>
3
  • Clean, Rebuild project Commented Aug 12, 2019 at 6:18
  • Incase of xml inflate exception the xml code should be posted instead of the java code. Commented Aug 12, 2019 at 6:19
  • Use TextView instead of DrawerLayout. Commented Aug 12, 2019 at 6:20

1 Answer 1

2

you type casting wrong , make Following changes

 ConstraintLayout txtSendMail;
    ConstraintLayout txtCall;
    ConstraintLayouttxtEmailFeedback;
    ConstraintLayout txtWebsite;

    txtSendMail=(ConstraintLayout)findViewById(R.id.txt_send_mail);
    txtCall=(ConstraintLayout)findViewById(R.id.txt_call);
    txtEmailFeedback=(ConstraintLayout)findViewById(R.id.txt_email_feedback);
    txtWebsite=(ConstraintLayout)findViewById(R.id.txt_website);
Sign up to request clarification or add additional context in comments.

1 Comment

See my added xml file

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.