Book Image

Voice Application Development for Android

Book Image

Voice Application Development for Android

Overview of this book

Speech technology has been around for some time now. However, it has only more recently captured the imagination of the general public with the advent of personal assistants on mobile devices that you can talk to in your own language. The potential of voice apps is huge as a novel and natural way to use mobile devices. Voice Application Development for Android is a practical, hands-on guide that provides you with a series of clear, step-by-step examples which will help you to build on the basic technologies and create more advanced and more engaging applications. With this book, you will learn how to create useful voice apps that you can deploy on your own Android device in no time at all. This book introduces you to the technologies behind voice application development in a clear and intuitive way. You will learn how to use open source software to develop apps that talk and that recognize your speech. Building on this, you will progress to developing more complex apps that can perform useful tasks, and you will learn how to develop a simple voice-based personal assistant that you can customize to suit your own needs. For more interesting information about the book, visit http://lsi.ugr.es/zoraida/androidspeechbook
Table of Contents (19 chapters)
Voice Application Development for Android
Credits
Foreword
About the Authors
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Afterword
Index

Threading


We will use XML files for various purposes in the remaining chapters and have encapsulated the common code in the XMLLib library. One important issue involves threading. When launching an app, a thread is created to run the code. This thread is responsible for the actions that involve updating the user interface, so it is sometimes called the UI thread. Carrying out very expensive operations in the UI thread, such as downloading files, carrying out HTTP requests, opening socket connections, or accessing databases, might block the UI thread for a long time, making it unresponsive and freezing updates of the interface. For this reason from Android 3 (HoneyComb) onwards, when trying to perform a networking operation on the main thread of an Android app, the android.os.NetworkOnMainThreadException is raised.

Android provides several ways to enable communication between background threads and the UI thread as explained here: http://developer.android.com/guide/components/processes-and...