Switch statements do not work with strings in all versions. You are using an older version where switch only supports int. Upgrade or use int instead of String.