0
curl -X PUT -d '{ "1": { "name": "Hauptbahnhof Berlin", "city": "Berlin"}, "2": { "name": "Hackerscher Markt", "city": "Berlin"}, "3": { "name": "Hauptbahnhof Frankfurt", "city": "Frankfurt"} }' 'https://xxx.firebaseio.com/stations.json'
{
"stations" : [ null, {
"city" : "Berlin",
"name" : "Hauptbahnhof Berlin"
}, {
"city" : "Berlin",
"name" : "Hackerscher Markt"
}, {
"city" : "Frankfurt",
"name" : "Hauptbahnhof Frankfurt"
} ]
}
はなぜ、今、null値を持っていますか?
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference stationsRef = database.getReference("stations");
stationsRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
ArrayList<Map<String, String>> value = (ArrayList<Map<String, String>>) dataSnapshot.getValue();
Log.d(TAG, "Value is: " + value.toString());
}
@Override
public void onCancelled(DatabaseError error) {
// Failed to read value
Log.w(TAG, "Failed to read value.", error.toException());
}
});
=>値は:[ヌル、{名前=ハウプトバーンベルリン、都市=ベルリン}、{名前は= Hackerscherマルクト、都市=ベルリン}、{名前=ハウプトバーンフランクフルト、 都市=フランクフルト} ]