async def on_list_view_selected(self, message: ListView.Selected) -> None:
        """Record device selection and switch stages."""
        selected_item = message.item
        device_info: AudioDevice = selected_item.device_info  # type: ignore
        if self.stage == "input":
            self.selected_input_device = device_info
            self.stage = "output"
            self.prompt.update("Select Output Audio Device:")
            self.populate_list(self.output_devices)
            if self.default_output_device:
                self._select_default_in_list(self.default_output_device)
        elif self.stage == "output":
            self.selected_output_device = device_info
            await self.action_quit()
Record device selection and switch stages.
examples/local-input-select-stt/select_audio_device.py