'Firestore data Update using Java from my android app
if (coin >= 100) {
herotimer.getDateTime(new Herotimer.VolleyCallback() {
@Override
public void onGetDateTime(String date) {
try {
Calendar c = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
c.setTime(sdf.parse(date));
c.add(Calendar.DATE,30);
SimpleDateFormat sdf1 = new SimpleDateFormat("MM/dd/yyyy");
String output = sdf1.format(c.getTime());
DocumentReference documentReference = database.collection("users").document(userID);
Map<String,Object> user = new HashMap<>();
user.put("date",output);
documentReference.set(user).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void unused) {
Log.d(TAG, "Successfully Updated"+ userID);
}
});
I want to update the data, but it doesn't show any error and does not even update the data. I am Updating the date that comes as Output in the code.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
