Skip to content Skip to sidebar Skip to footer

Unable To Read Objects From Firebase Database Snapshot

I am trying to read latitude and longitude from Firebase and putting marker on those locations. But there seems some error crashing the app which I am unable to find even on Logcat

Solution 1:

Initialize the stations List.

List<Stations> stations= new ArrayList<>();

The logic of adding the markers seems alright to me. Just adding it at the right place, as told by Momen, should work.

Solution 2:

1- The object Stations has to be like the object in firebase. like that

publicclassStations{

public Location location;
publicString name

//..getter and setterpublicstaticclassLocation{
publicdouble latitude;
publicdouble  longitude;

//..getter and setter

}
}

the fields have to be public

2- initialize the arraylist

List<Stations> stations=newArraylist();

Post a Comment for "Unable To Read Objects From Firebase Database Snapshot"