My aim is to print out a toast message if the user does not enter some data. I have tried an if statement, but it does not seem to work. Any suggestions.
Thanks
Data data = new Data(data);
FirebaseUser user = firebaseAuth.getCurrentUser();
if(etAddNewTopic.getText().toString() == null || etAddNewTopic.getText().toString() == "") {
Toast.makeText(getBaseContext(), "Field cannot be left blank", Toast.LENGTH_SHORT).show();
startActivity(new Intent(this, NewActivity.class));
} else {
databaseReference.child(user.getUid()).setValue(data);
databaseReference.child("Data List").setValue(data);
}
progressDialog.setMessage("Adding Data...");
progressDialog.show();
startActivity(new Intent(getApplicationContext(), DataListActivity.class));
}