I got error in my android studio

I got error in my android studio
0

#1

This the error

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.constaraint_nice_pc.penghitungskor, PID: 3455
                  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.constaraint_nice_pc.penghitungskor/com.example.constaraint_nice_pc.penghitungskor.HitungScoreBasket}: android.view.InflateException: Binary XML file line #0: 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:2817)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
                      at android.app.ActivityThread.-wrap11(Unknown Source:0)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
                      at android.os.Handler.dispatchMessage(Handler.java:105)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6541)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                   Caused by: android.view.InflateException: Binary XML file line #0: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
                   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:764)
                      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                      at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
                      at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                      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:287)
                      at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
                      at com.example.constaraint_nice_pc.penghitungskor.HitungScoreBasket.onCreate(HitungScoreBasket.java:13)
                      at android.app.Activity.performCreate(Activity.java:6975)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
                      at android.app.ActivityThread.-wrap11(Unknown Source:0)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
                      at android.os.Handler.dispatchMessage(Handler.java:105)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6541)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Application terminated.

package com.example.constaraint_nice_pc.penghitungskor;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class HitungScoreBasket extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hitung_score_basket);

        Intent i = this.getIntent();

        String namaA = i.getStringExtra("namaA");
        String namaB = i.getStringExtra("namaB");

        TextView TnamaA = findViewById(R.id.namaA);
        TextView TnamaB = findViewById(R.id.namaB);

        TnamaA.setText(namaA);
        TnamaB.setText(namaB);
    }
}


#2

Unlucky. Good luck with that! :space_invader:


#3

Found a similar issue on StackOverflow: https://stackoverflow.com/questions/45085879/android-studio-unable-to-start-activity-componentinfo

Maybe this can help you.


#4

@uskut, you have the error listed in the backtrace:

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference

You are trying to access something that is not there, in this case, is null.
Did you check the intent? Did you check that the extras you are getting exist?
Is the name you specified for the extra identical to what it was when it was placed?
Are the views found?

These are all issues I would verify.