database = FirebaseDatabase.getInstance();
myRef = database.getReference("Update");
// Read from the database
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// This method is called once with the initial value and again
// whenever data at this location is updated.
String value = dataSnapshot.getValue(String.class);
if (value.toString() == "1.0")
{
Toast.makeText(getApplication(), "No Update" , Toast.LENGTH_LONG).show();
}
else {Toast.makeText(getApplication(), "Need Update" , Toast.LENGTH_LONG).show();}
}
@Override
public void onCancelled(DatabaseError error) {
// Failed to read value
Toast.makeText(getApplication(), "Failed to read value." + error.toException() , Toast.LENGTH_LONG).show();
}
});
value is 1.0 and string in if is 1.0 but when i run the app show me need update, why is that? i want hem to show me update.