'Not able to access firebase db in android studio
I'm new to firebase and NoSQL.
I'm not able to read the values from firebase. Also, I've tried every method but latlng returns null because it is not added.
Here is the code:
mDatabase = FirebaseDatabase.getInstance().getReference().child("latlong");
mDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
progressDialog.dismiss();
for (DataSnapshot postSnapshot: dataSnapshot.getChildren()) {
Log.i(TAG,postSnapshot.getValue().toString());
String value = postSnapshot.child("latitude").getValue(String.class);
String value1 = postSnapshot.child("longitude").getValue(String.class);
LatLng n= new LatLng(Double.parseDouble(value),Double.parseDouble(value1));
latlng.add(n);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
