android java add new record to Firebase Firestore
Map<String, Object> city = new HashMap<>();
city.put("name", "Los Angeles");
city.put("state", "CA");
city.put("country", "USA");
db.collection("cities").document("LA")
.set(city)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.d(TAG, "DocumentSnapshot successfully written!");
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.w(TAG, "Error writing document", e);
}
});
Also in Java:
- throwing exceptions java
- immagini java
- java call another constructor
- java for increment by 2
- inheritance setter and getter in java
- java switch
- hide element selenium
- java variables in annotations
- float to string java
- java convert String to int
- java jpa criteriabuilder in xample
- java map foreach
- ceil function in java
- loop collection android
- java processbuilder example
- android hide and show bottom navigation
- how to open a folder in java swing project
- java exponencial
- java 8 stream option
- shorthand if java without else
- java variable declared
- The shrinker may have failed to optimize the Java bytecode. To disable the shrinker, pass the `--no-shrink` flag to this command.
- update value of an arraylist java
- java function without return