The change has to be done in the NewCharcterActivity.kt file as stated later. But only this code worked for me adding CharacterGenerator to call the function:
generateButton.setOnClickListener {
launch(UI) {
characterData = CharacterGenerator.fetchCharacterData().await()
displayCharacterData()
}
}
I am using Android Studio 3.3.2