-1

My android studio app keeps stopping and doesn't showing errors. I'm beginner in android studio.

logcat:

 --------- beginning of crash
2021-06-20 14:52:14.180 1778-1778/com.example.foodorderapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.foodorderapp, PID: 1778
    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
        at com.example.foodorderapp.Adapters.MainAdapter.getItemCount(MainAdapter.java:48)
        at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:4044)
       
James Z
  • 12,104
  • 10
  • 27
  • 43
haris
  • 1
  • 1
    Hi, would you please provide a code snippet causing this error? Right now, the only thing I can tell you is that you're trying to call a method of an object that is not instantiated at that point in time. Here's the documentation of java.lang.NullPointerException: https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html – Antricks Jun 20 '21 at 10:42

1 Answers1

0

you can find your answer if you just search this:

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object

check this answer

Mhb flh
  • 21
  • 8