The Error I get from my app
My Error
java.lang.NullPointerException: Attempt to invoke virtual method
'java.lang.String com.populargeng.trackamechanic.Model.Client.getName()' on a
null object reference
at com.populargeng.trackamechanic.Home$5$1.onDataChange(Home.java:355)
My Code Line I wrote
My Code
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// Because Client and User Model is same properties
// So we can use the Client Model to get User here
Client client = dataSnapshot.getValue(Client.class);
// Add client to map
mMap.addMarker(new MarkerOptions().position(new LatLng(location.latitude, location.longitude))
.flat(true).title(client.getName())
.snippet("Phone: "+client.getPhone())
.icon(BitmapDescriptorFactory.fromResource(R.drawable.repair)));
}
Please How do I correct this.. ? It was working earlier but now its not working anymore