This example lists the available text-to-speech (TTS) voice languages, lets the user pick one, and plays a sample spoken phrase in the selected language. It is a good illustration that the SDK's sound and TTS services can be used without a map - there is no GemSurfaceView here; the SDK is initialized directly and only the sound APIs are used.
Because there is no map view to initialize the SDK for us, GemSdk.initSdkWithDefaults is called explicitly - this step is mandatory when using the SDK without a map. The TTS player initializes asynchronously, so the activity implements ITTSPlayerInitializationListener and registers it before initialization, ensuring no callback is missed if the player initializes synchronously. If the player is already initialized by the time setup finishes, the languages are loaded right away.
registerSdkListeners adds the TTS initialization listener, which covers the case where the player becomes ready after the SDK but before loadTTSLanguages is called.
Once the TTS player is ready, loadTTSLanguages reads the full list of supported voice languages with SoundPlayingService.getTTSLanguages(). Each entry is a TTSLanguage carrying a display name and an ISO code.
When the list is available, the first language (index 0) is shown as the current selection and applied immediately with setTTSLanguage, so playback works even before the user picks anything. The selection button and the play button are then revealed.
Tapping the Click to select new language button opens a dialog whose RecyclerView lists every TTSLanguage, backed by a CustomAdapter. The currently selected entry is shown with a checked radio button.
// Pass the dialog reference so each item click can dismiss it.
adapter.dialog = dialog
}
Each row shows the language name and its code. Tapping a row applies that language with SoundPlayingService.setTTSLanguage(code), updates the displayed selection, and dismisses the dialog.
The Play sound button speaks a built-in, localized navigation phrase - "mind your speed" - in the currently selected language. GemUtil.getTTSString(EStringIds.eStrMindYourSpeed) returns the text for that phrase, and SoundPlayingService.playText synthesizes it through the TTS player.