I want to store what a user is saying (or get the value of a slot) and store it in a variable. Something like this:
String employee = intent.getSlot("Employee").getValue();
Alexa gives the right speechOutput so it gets the slot, however if i Say "Peter" and then make an if-statement (employee == "Peter")
it always seems to be false. Can someone explain what I am missing?
public static SpeechletResponse getFact(final Intent intent, final Session session) {
Map<String, Slot> slots = intent.getSlots();
// Get the employee from the list of slots.
Slot employeeSlot = slots.get("Employee");
String speechText, repromptText;
if (employeeSlot != null) {
String employee = employeeSlot.getValue();
if (employee == "Peter") {
speechText =
String.format("Pasta is the favorite food of %s.", mitarbeiter);
} else {
// I always end up here
}
...