I have implement an if statement in my Java android studio code. During runtime it keeps on repeating again and again. I have used System.exit(0); but it stops the running code. How can I prevent the if statement from repeating?
mrRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
Map<String, Object> map = (Map<String, Object>) dataSnapshot.getValue();
String balances = (String) map.get("amount");
String ibalances = (String) map.get("investment");
String fbalances = (String) map.get("fradxcoin");
int countss = Math.round(Float.parseFloat(balances));
float ballss = (float) (countss + (ballsbi));
String strAmounts = String.valueOf(ballss);
Names names = new Names(idpp, strAmounts, ibalances, fbalances);
rdatabaseReference.child(idpp).child("balance").setValue(names);
} else {
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
Aucun commentaire:
Enregistrer un commentaire