Currently, I am working on developing a GPS app that includes a contact list feature for connecting with other individuals. As a newcomer to Android Studio, I am encountering some challenges in resolving an issue. Initially, I successfully implemented the map and GPS functionality; however, I am now facing an error with the contact list feature.
The contact list is accessible through a popup menu triggered by the contacts button on the homepage. Unfortunately, I consistently encounter an error when attempting to access the contact list.
The error message logged is as follows: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ListView.setAdapter(android.widget.ListAdapter)' on a null object reference
Here is the snippet of the MainActivity code:
[code snippet provided]
Additionally, here are the relevant details from the AndroidManifest file:
[AndroidManifest details]
Moreover, I have included the SelectUser and SelectUserAdapter classes for reference:
[SelectUser and SelectUserAdapter class details]
Lastly, the activitymaps.xml layout file and contactlist.xml and contactview.xml layout files have been included to provide a better understanding of the app's UI.
[activitymaps.xml, contactlist.xml, and contactview.xml details]
Upon encountering the error, the stack trace generated is:
[Error stack trace details]