web-dev-qa-db-fra.com

Obtention de la ligne de fichier XML binaire n ° 141: Tentative d’appel de la méthode virtuelle 'boolean Java.lang.String.equals (Java.lang.Object)' sur une référence d'objet null

Logcat

05-11 19:14:52.567 4489-4489/? E/AndroidRuntime: 
FATAL EXCEPTION: main                                                  
       Process: com.grab.deals.dealcart, PID: 4489
       Java.lang.RuntimeException: Unable to start activity ComponentInfo{com.grab.deals.dealcart/com.grab.deals.dealcart.Full_view.Full_view}: Android.view.InflateException: Binary XML file line #141: Attempt to invoke virtual method 'boolean Java.lang.String.equals(Java.lang.Object)' on a null object reference
       at Android.app.ActivityThread.performLaunchActivity(ActivityThread.Java:2416)
       at Android.app.ActivityThread.handleLaunchActivity(ActivityThread.Java:2476)
       at Android.app.ActivityThread.-wrap11(ActivityThread.Java)
       at Android.app.ActivityThread$H.handleMessage(ActivityThread.Java:1344)
       at Android.os.Handler.dispatchMessage(Handler.Java:102)
       at Android.os.Looper.loop(Looper.Java:148)
       at Android.app.ActivityThread.main(ActivityThread.Java:5417)
       at Java.lang.reflect.Method.invoke(Native Method)
       at com.Android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.Java:726)
       at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:616)
       Caused by: Android.view.InflateException: Binary XML file line #141: Attempt to invoke virtual method 'boolean Java.lang.String.equals(Java.lang.Object)' on a null object reference
       at Android.view.LayoutInflater.inflate(LayoutInflater.Java:539)
       at Android.view.LayoutInflater.inflate(LayoutInflater.Java:423)
       at Android.view.LayoutInflater.inflate(LayoutInflater.Java:374)
       at Android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.Java:284)
       at Android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.Java:143)
       at com.grab.deals.dealcart.Full_view.Full_view.onCreate(Full_view.Java:13)
       at Android.app.Activity.performCreate(Activity.Java:6237)
       at Android.app.Instrumentation.callActivityOnCreate(Instrumentation.Java:1107)
       at Android.app.ActivityThread.performLaunchActivity(ActivityThread.Java:2369)
       at Android.app.ActivityThread.handleLaunchActivity(ActivityThread.Java:2476) 
       at Android.app.ActivityThread.-wrap11(ActivityThread.Java) 
       at Android.app.ActivityThread$H.handleMessage(ActivityThread.Java:1344) 
       at Android.os.Handler.dispatchMessage(Handler.Java:102) 
       at Android.os.Looper.loop(Looper.Java:148) 
       at Android.app.ActivityThread.main(ActivityThread.Java:5417) 
       at Java.lang.reflect.Method.invoke(Native Method) 
       at com.Android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.Java:726) 
       at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:616) 
       Caused by: Java.lang.NullPointerException: Attempt to invoke virtual method 'boolean Java.lang.String.equals(Java.lang.Object)' on a null object reference
       at Android.view.LayoutInflater.createViewFromTag(LayoutInflater.Java:738)
       at Android.view.LayoutInflater.createViewFromTag(LayoutInflater.Java:704)
       at Android.view.LayoutInflater.rInflate(LayoutInflater.Java:835)
       at Android.view.LayoutInflater.rInflateChildren(LayoutInflater.Java:798)
       at Android.view.LayoutInflater.rInflate(LayoutInflater.Java:838)
       at Android.view.LayoutInflater.rInflateChildren(LayoutInflater.Java:798)
       at Android.view.LayoutInflater.rInflate(LayoutInflater.Java:838)
       at Android.view.LayoutInflater.rInflateChildren(LayoutInflater.Java:798)
       at Android.view.LayoutInflater.rInflate(LayoutInflater.Java:838)
       at Android.view.LayoutInflater.rInflateChildren(LayoutInflater.Java:798)
       at Android.view.LayoutInflater.rInflate(LayoutInflater.Java:838)
       at Android.view.LayoutInflater.rInflateChildren(LayoutInflater.Java:798)
       at Android.view.LayoutInflater.inflate(LayoutInflater.Java:515)
       at Android.view.LayoutInflater.inflate(LayoutInflater.Java:423) 
       at Android.view.LayoutInflater.inflate(LayoutInflater.Java:374) 
       at Android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.Java:284) 
       at Android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.Java:143) 
       at com.grab.deals.dealcart.Full_view.Full_view.onCreate(Full_view.Java:13) 
       at Android.app.Activity.performCreate(Activity.Java:6237) 
       at Android.app.Instrumentation.callActivityOnCreate(Instrumentation.Java:1107) 
       at Android.app.ActivityThread.performLaunchActivity(ActivityThread.Java:2369) 
       at Android.app.ActivityThread.handleLaunchActivity(ActivityThread.Java:2476) 
       at Android.app.ActivityThread.-wrap11(ActivityThread.Java) 
       at Android.app.ActivityThread$H.handleMessage(ActivityThread.Java:1344) 
       at Android.os.Handler.dispatchMessage(Handler.Java:102) 
       at Android.os.Looper.loop(Looper.Java:148) 
       at Android.app.ActivityThread.main(ActivityThread.Java:5417) 
       at Java.lang.reflect.Method.invoke(Native Method) 
       at com.Android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.Java:726) 
       at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:616) 

ExtendView.xml

    <RelativeLayout xmlns:Android="http://schemas.Android.com/apk/res/Android"
    xmlns:tools="http://schemas.Android.com/tools"
    xmlns:app="http://schemas.Android.com/apk/res-auto"
    Android:id="@+id/activity_full_view"
    Android:layout_width="match_parent"
    Android:layout_height="match_parent">
    <ScrollView
        Android:layout_width="match_parent"
        Android:layout_height="match_parent">
        <LinearLayout
            Android:layout_width="match_parent"
            Android:layout_height="match_parent"
            Android:orientation="vertical">
    <Android.support.v7.widget.CardView
        Android:layout_width="match_parent"
        Android:layout_height="match_parent"
        Android:layout_margin="5dp">
        <LinearLayout
            Android:layout_width="match_parent"
            Android:layout_height="match_parent"
            Android:orientation="vertical">
        <ImageView
            Android:layout_width="match_parent"
            Android:layout_height="300dp"

            Android:id="@+id/img"/>
        <View
            Android:layout_width="match_parent"
            Android:layout_height="1dp"/>
            <TextView
                Android:layout_width="wrap_content"
                Android:layout_height="wrap_content"
                Android:text="Designer shirt"
                Android:textSize="15dp"
                Android:layout_marginLeft="10dp"
                Android:textColor="#000"/>
            <LinearLayout
                Android:layout_width="wrap_content"
                Android:layout_height="wrap_content"
                Android:orientation="horizontal">
                <TextView
                    Android:layout_width="wrap_content"
                    Android:layout_height="wrap_content"
                    Android:textSize="12dp"
                    Android:text="Speatial Price"
                    Android:layout_marginLeft="10dp"
                    Android:textColor="#34a853"/>
                <TextView
                    Android:layout_width="wrap_content"
                    Android:layout_marginLeft="5dp"
                    Android:layout_height="wrap_content"
                    Android:textColor="#000"
                    Android:text="Ends in few hours"
                   />
            </LinearLayout>
            <LinearLayout
                Android:layout_width="wrap_content"
                Android:layout_height="wrap_content"
                Android:orientation="horizontal">
            <TextView
                Android:layout_width="wrap_content"
                Android:layout_height="wrap_content"
                Android:textSize="20dp"
                Android:text="25,000"
                Android:layout_marginLeft="10dp"
                Android:textColor="#000"/>
                <TextView
                    Android:layout_width="wrap_content"
                    Android:layout_marginLeft="10dp"
                    Android:layout_height="wrap_content"
                    Android:textColor="@color/colorPrimary"
                    Android:text="70%off"
                    Android:textSize="15dp"/>
            </LinearLayout>
        <LinearLayout
            Android:layout_width="wrap_content"
            Android:layout_height="wrap_content"
            Android:orientation="horizontal">
            <TextView
                Android:layout_width="wrap_content"
                Android:layout_marginLeft="10dp"
                Android:layout_height="wrap_content"
                Android:textColor="#34a853"
                Android:text="4.1"/>

            <ImageView
                Android:layout_width="15dp"
                Android:layout_height="15dp"
                app:srcCompat="@drawable/ic_star_border_black_24dp"/>
            </LinearLayout>
            <View
                Android:layout_width="match_parent"
                Android:layout_height="1dp"/>
<LinearLayout
    Android:layout_width="match_parent"
    Android:layout_height="wrap_content"
    Android:orientation="horizontal"
    Android:gravity="center"
    Android:layout_gravity="center"
    Android:layout_marginBottom="5dp">


 <ImageView
     Android:layout_width="30dp"
     Android:layout_height="30dp"
     app:srcCompat="@drawable/copy"/>
    <TextView
        Android:layout_width="wrap_content"
        Android:layout_height="wrap_content"
        Android:textColor="#000"
        Android:layout_marginLeft="10dp"
        Android:text="Copy Coupon"
        Android:textSize="20sp"
        />


</LinearLayout>
        </LinearLayout>

    </Android.support.v7.widget.CardView>


        <Android.support.v7.widget.CardView
            Android:layout_width="match_parent"
            Android:layout_height="wrap_content"
            Android:layout_margin="5dp"
            >
            <LinearLayout
                Android:layout_width="match_parent"
                Android:layout_height="wrap_content"
                Android:orientation="vertical">
<TextView
    Android:layout_width="match_parent"
    Android:layout_height="match_parent"
    Android:text="Details"
    Android:layout_margin="20dp"
    Android:textSize="20sp"
    Android:textColor="#000"/>
                <view
                    Android:layout_width="match_parent"
                    Android:layout_height="1dp"/>

                <TextView
                    Android:layout_width="wrap_content"
                    Android:layout_height="wrap_content"
                    Android:textSize="17sp"
                    Android:textColor="#000"
                    Android:layout_margin="20dp"
                    Android:text="Heighlets \n*shgdfshdflshflsjh\n*a;sjkdfjshgf"/>
            </LinearLayout>
        </Android.support.v7.widget.CardView>

            <Android.support.v7.widget.CardView
                Android:layout_width="match_parent"
                Android:layout_height="wrap_content"
                Android:layout_margin="5dp"
                >
                <LinearLayout
                    Android:layout_width="match_parent"
                    Android:layout_height="wrap_content"
                    Android:orientation="vertical">
                    <TextView
                        Android:layout_width="match_parent"
                        Android:layout_height="match_parent"
                        Android:text="Terms and Conditions"
                        Android:layout_margin="20dp"
                        Android:textSize="20sp"
                        Android:textColor="#000"/>
                    <view
                        Android:layout_width="match_parent"
                        Android:layout_height="1dp"/>

                    <TextView
                        Android:layout_width="wrap_content"
                        Android:layout_height="wrap_content"
                        Android:textSize="17sp"
                        Android:textColor="#000"
                        Android:layout_margin="20dp"
                        Android:text="Heighlets \n*shgdfshdflshflsjh\n*a;sjkdfjshgf"/>
                </LinearLayout>
            </Android.support.v7.widget.CardView>

            <Android.support.v7.widget.CardView
                Android:layout_width="match_parent"
                Android:layout_height="wrap_content"
                Android:layout_margin="5dp"
                >
                <LinearLayout
                    Android:layout_width="match_parent"
                    Android:layout_height="wrap_content"
                    Android:orientation="vertical">
                    <TextView
                        Android:layout_width="match_parent"
                        Android:layout_height="match_parent"
                        Android:text="Ratings &amp; Reviews"
                        Android:layout_margin="20dp"
                        Android:textSize="20sp"
                        Android:textColor="#000"/>
                    <view
                        Android:layout_width="match_parent"
                        Android:layout_height="1dp"/>
                    <LinearLayout
                        Android:layout_width="wrap_content"
                        Android:layout_height="wrap_content"
                        Android:layout_gravity="center"
                        Android:layout_margin="20dp"
                        Android:orientation="vertical">
                    <LinearLayout
                        Android:layout_width="wrap_content"
                        Android:layout_height="wrap_content"
                        Android:layout_gravity="center"
                        Android:orientation="horizontal">

                        <TextView
                            Android:layout_width="wrap_content"
                            Android:layout_height="wrap_content"
                            Android:text="4.1"
                            Android:layout_marginRight="10dp"
                            Android:textSize="40sp"/>
                        <ImageView
                            Android:layout_width="50dp"
                            Android:layout_height="50dp"
                            app:srcCompat="@drawable/ic_star_border_black_24dp"/>
                    </LinearLayout>
                        <TextView
                            Android:layout_width="wrap_content"
                            Android:layout_height="wrap_content"
                            Android:text="1,500 Reviews"
                            />
                    </LinearLayout>

                           </LinearLayout>
            </Android.support.v7.widget.CardView>
    </LinearLayout>
        </ScrollView>
<LinearLayout
    Android:layout_width="match_parent"
    Android:layout_height="wrap_content"
    Android:orientation="horizontal"
    Android:background="#fff"
    Android:layout_alignParentBottom="true"
    Android:gravity="center">
    <Button
        Android:layout_width="180dp"
        Android:layout_height="50dp"
        Android:text="Share"
        style="@style/Widget.AppCompat.Button.Borderless.Colored"/>

    <Button
        Android:layout_width="180dp"
        Android:layout_height="50dp"
        Android:text="Visit"
        Android:textColor="#fff"
        style="@style/Widget.AppCompat.Button.Borderless.Colored"
        Android:background="@color/colorPrimary"/>



</LinearLayout>


</RelativeLayout>

Full_View.Java

public class Full_View extends Fragment {

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootview = inflater.inflate(R.layout.activity_full_view,container,false);
        return rootview;
    }

}
32
hitesh soni
 <view
                Android:layout_width="match_parent"
                Android:layout_height="1dp"/>

Changez view en View aux 4 ou 5 positions où il est en minuscule dans votre xml

253
Speed

s'il vous plaît 

         <view
            Android:layout_width="match_parent"
            Android:layout_height="1dp"/>  

Changer en 

        <View
            Android:layout_width="match_parent"
            Android:layout_height="1dp"/> 
2
Sudhir singh

C'est la vue dans votre ExtendView.xml, la vue la remplace.

0
KKaKa