/* * Copyright (C) 2009 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.apis.app; import android.app.Activity; import android.os.Bundle; import android.speech.tts.TextToSpeech; import android.util.Log; import android.view.View; import android.widget.Button; import com.example.android.apis.R; import java.util.Locale; import java.util.Random; /** *

Demonstrates text-to-speech (TTS). Please note the following steps:

* *
    *
  1. Construct the TextToSpeech object.
  2. *
  3. Handle initialization callback in the onInit method. * The activity implements TextToSpeech.OnInitListener for this purpose.
  4. *
  5. Call TextToSpeech.speak to synthesize speech.
  6. *
  7. Shutdown TextToSpeech in onDestroy.
  8. *
* *

Documentation: * http://developer.android.com/reference/android/speech/tts/package-summary.html *

*