Error when i create the table
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.gestionelamiere, PID: 26419
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gestionelamiere/com.example.gestionelamiere.Riepilogo}: java.lang.NullPointerException: Attempt to invoke virtual method 'void de.codecrafters.tableview.TableView.setHeaderAdapter(de.codecrafters.tableview.TableHeaderAdapter)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3271)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3410)
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:2017)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7397)
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:935)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void de.codecrafters.tableview.TableView.setHeaderAdapter(de.codecrafters.tableview.TableHeaderAdapter)' on a null object reference
at com.example.gestionelamiere.Riepilogo.onCreate(Riepilogo.java:32)
at android.app.Activity.performCreate(Activity.java:7825)
at android.app.Activity.performCreate(Activity.java:7814)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3246)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3410)
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:2017)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7397)
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:935)
Riepilogo.java
TableView list = findViewById(R.id.List); String[] headers ={"Articolo","Lotto","Quantità","Utente"}; list.setHeaderAdapter(new SimpleTableHeaderAdapter(this,headers));
activity_main.xml <de.codecrafters.tableview.TableView android:id="@+id/List" android:layout_width="match_parent" android:layout_height="match_parent" app:tableView_columnCount="4" />
Error when i create the table E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.gestionelamiere, PID: 26419 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gestionelamiere/com.example.gestionelamiere.Riepilogo}: java.lang.NullPointerException: Attempt to invoke virtual method 'void de.codecrafters.tableview.TableView.setHeaderAdapter(de.codecrafters.tableview.TableHeaderAdapter)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3271) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3410) 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:2017) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7397) 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:935) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void de.codecrafters.tableview.TableView.setHeaderAdapter(de.codecrafters.tableview.TableHeaderAdapter)' on a null object reference at com.example.gestionelamiere.Riepilogo.onCreate(Riepilogo.java:32) at android.app.Activity.performCreate(Activity.java:7825) at android.app.Activity.performCreate(Activity.java:7814) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3246) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3410) 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:2017) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7397) 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:935)