Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DatabaseReference refCount;
- DataSnapshot datCount;
- public void initCountFoodInstances(){
- refCount = data.getReference("contador");
- refCount.addValueEventListener(new ValueEventListener() {
- @Override
- public void onDataChange(DataSnapshot ds) {
- datCount = ds;
- }
- @Override
- public void onCancelled(DatabaseError de) {
- System.out.println("Error");
- }
- });
- }
- public void addCountFood(){
- int size = Integer.parseInt(datCount.getValue(String.class));
- refCount.setValue((size+1)+"");
- }
Add Comment
Please, Sign In to add comment