I am unable to fetch the data from Firebase to Android. I am using the POJO (Java object class) method to display the values.
This is how I have arranged my data on Firebase:
This is my POJO class "MonitoringPojo.java".
public class MonitoringPojo {
Results results;
public Results getResults(){
return results;
}
public class Results {
double MaxLat;
double MaxLng;
double MinLat;
double MinLng;
String Congestion_Status;
public double getMaxLat() {
return MaxLat;
}
public double getMaxLng() {
return MaxLng;
}
public double getMinLat() {
return MinLat;
}
public double getMinLng() {
return MinLng;
}
public String getCongestion_Status() {
return Congestion_Status;
}
}
}
This is where I am trying to fetch and display the values from the FireBase via that POJO class.
MonitoringPojo pojo = dataSnapshot.getValue(MonitoringPojo.class);
double sourceOne = pojo.results.getMaxLat();
double destinationOne = pojo.results.getMaxLng();
double sourceTwo= pojo.results.getMinLat();
double destinationTwo= pojo.results.getMinLng();
String fetchedColor=pojo.results.getCongestion_Status().toString();
DrawPolygon2(sourceOne,destinationOne,sourceTwo,destinationTwo,fetchedColor);
But unfortunatley I am getting nothing displayed.
Any help would be appreciated. Thankyou!