Java Code Examples for com.firebase.client.DataSnapshot#child()

The following examples show how to use com.firebase.client.DataSnapshot#child() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DetailPresenter.java    From animation-samples with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
protected Detail parseData(DataSnapshot data) {
        String title = data.child(JsonKeys.TITLE).getValue(String.class);
        String description = data.child(JsonKeys.DESCRIPTION).getValue(String.class);
        LatLng latLng = DataUtils.readLatLng(data);
        DataSnapshot location = data.child(JsonKeys.LOCATION);
        Float tilt = location.child(JsonKeys.TILT).getValue(Float.class);
        Float bearing = location.child(JsonKeys.BEARING).getValue(Float.class);
    return new Detail(title, description, latLng, tilt, bearing);
}
 
Example 2
Source File: DataUtils.java    From animation-samples with Apache License 2.0 4 votes vote down vote up
/**
 * Read latitude and longitude data from a snapshot's child called {@link JsonKeys#LOCATION}.
 */
public static @NonNull LatLng readLatLng(@NonNull DataSnapshot snapshot) {
    final DataSnapshot location = snapshot.child(JsonKeys.LOCATION);
    double lat = location.child(JsonKeys.LATITUDE).getValue(Double.class);
    double lng = location.child(JsonKeys.LONGITUDE).getValue(Double.class);
    return new LatLng(lat, lng);
}