How to solve this FATAL EXCEPTION: main some show null point exception

-3

I have this code. I want to send Arraylist in this activity to another activity and when I run this it's show some error like this FATAL Exception.

This is my code in which show error

package com.example.testapp;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import com.backendless.Backendless;
import com.backendless.async.callback.AsyncCallback;
import com.backendless.exceptions.BackendlessFault;
import com.backendless.persistence.DataQueryBuilder;
import java.util.List;

public class ContactList extends AppCompatActivity {
    ListView listContact;
    contacdeails adepter;

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(requestCode==1)
        {
            adepter.notifyDataSetChanged();
        }

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_contact_list);
        listContact=findViewById(R.id.listviewContact);

        listContact.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id)
            {
                Intent intent=new Intent(ContactList.this,contacdeails.class);
                intent.putExtra("index",position);
                startActivityForResult(intent,1);
            }

        });


        String whereclas="userEmail= '" + New.user.getEmail() + "'";

        DataQueryBuilder dataQueryBuilder=DataQueryBuilder.create();
        dataQueryBuilder.setWhereClause(whereclas+"");
        dataQueryBuilder.setGroupBy("name");

        Backendless.Persistence.of(Person.class).find(dataQueryBuilder, new AsyncCallback<List<Person>>() {
            @Override
            public void handleResponse(List<Person> response) {
                New.personList=response;
                adepter=new contacdeails(getApplicationContext(),New.personList);
                listContact.setAdapter(adepter);
                Toast.makeText(ContactList.this, "Updated Successfull Your List", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void handleFault(BackendlessFault fault) {
                Toast.makeText(ContactList.this, "Error"+fault.getMessage(), Toast.LENGTH_SHORT).show();
            }
        });
    }

}

This is My Logcat

2020-08-02 12:12:30.632 22258-22258/? I/example.testap: Late-enabling -Xcheck:jni
2020-08-02 12:12:30.681 22258-22258/? E/example.testap: Unknown bits set in runtime_flags: 0x8000
2020-08-02 12:12:31.016 22258-22258/com.example.testapp W/example.testap: Accessing hidden method Landroid/app/ActivityThread;->currentApplication()Landroid/app/Application; (greylist, reflection, allowed)
2020-08-02 12:12:31.160 22258-22258/com.example.testapp E/example.testap: Invalid ID 0x00000000.
2020-08-02 12:12:31.228 22258-22258/com.example.testapp W/example.testap: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2020-08-02 12:12:31.229 22258-22258/com.example.testapp W/example.testap: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2020-08-02 12:12:31.358 22258-22292/com.example.testapp I/AdrenoGLES: QUALCOMM build                   : f2ab992, I401605978b
    Build Date                       : 09/28/19
    OpenGL ES Shader Compiler Version: EV031.27.05.01
    Local Branch                     : 
    Remote Branch                    : 
    Remote Branch                    : 
    Reconstruct Branch               : 
2020-08-02 12:12:31.358 22258-22292/com.example.testapp I/AdrenoGLES: Build Config                     : S L 8.0.11 AArch64
2020-08-02 12:12:31.364 22258-22292/com.example.testapp I/AdrenoGLES: PFP: 0x005ff112, ME: 0x005ff066
2020-08-02 12:12:31.367 22258-22292/com.example.testapp W/AdrenoUtils: <ReadGpuID_from_sysfs:194>: Failed to open /sys/class/kgsl/kgsl-3d0/gpu_model
2020-08-02 12:12:31.367 22258-22292/com.example.testapp W/AdrenoUtils: <ReadGpuID:218>: Failed to read chip ID from gpu_model. Fallback to use the GSL path
2020-08-02 12:12:31.364 22258-22258/com.example.testapp W/RenderThread: type=1400 audit(0.0:17188330): avc: denied { read } for uid=10614 name="gpu_model" dev="sysfs" ino=30970 scontext=u:r:untrusted_app:s0:c102,c258,c512,c768 tcontext=u:object_r:sysfs_kgsl:s0 tclass=file permissive=0
2020-08-02 12:12:31.396 22258-22292/com.example.testapp W/Gralloc3: mapper 3.x is not supported
2020-08-02 12:12:34.892 22258-22258/com.example.testapp W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@b01f182
2020-08-02 12:12:34.939 22258-22258/com.example.testapp D/AndroidRuntime: Shutting down VM
2020-08-02 12:12:34.941 22258-22258/com.example.testapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.testapp, PID: 22258
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testapp/com.example.testapp.ContactList}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.backendless.BackendlessUser.getEmail()' on a null object reference
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3477)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3620)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2183)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:241)
        at android.app.ActivityThread.main(ActivityThread.java:7617)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.backendless.BackendlessUser.getEmail()' on a null object reference
        at com.example.testapp.ContactList.onCreate(ContactList.java:50)
        at android.app.Activity.performCreate(Activity.java:7810)
        at android.app.Activity.performCreate(Activity.java:7799)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1328)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3452)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3620) 
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2183) 
        at android.os.Handler.dispatchMessage(Handler.java:107) 
        at android.os.Looper.loop(Looper.java:241) 
        at android.app.ActivityThread.main(ActivityThread.java:7617) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941) 

Show This is error

https://i.stack.imgur.com/yHxWZ.png

android
fatal-error
asked on Stack Overflow Aug 2, 2020 by Harsh Sureja • edited Aug 2, 2020 by halfer

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0