Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Voice Application Development for Android

You're reading from  Voice Application Development for Android

Product type Book
Published in Nov 2013
Publisher Packt
ISBN-13 9781783285297
Pages 134 pages
Edition 1st Edition
Languages

Table of Contents (19) Chapters

Voice Application Development for Android
Credits
Foreword
About the Authors
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
1. Speech on Android Devices 2. Text-to-Speech Synthesis 3. Speech Recognition 4. Simple Voice Interactions 5. Form-filling Dialogs 6. Grammars for Dialog 7. Multilingual and Multimodal Dialogs 8. Dialogs with Virtual Personal Assistants 9. Taking it Further Afterword
Index

XMLLib


In our library (sandra.libs.util.xmllib in the code bundle), the RetrieveXMLTask (see RetrieveXMLTask.java) is responsible for fetching an XML file from the web and saving its content in a String to be further processed. It is declared in the following way:

  class RetrieveXMLTask extends AsyncTask<String, Void, String>

It has been defined as an asynchronous task (AsyncTask) that receives a collection of Strings as input parameters. It does not produce any type of progress values (void), and produces a String as a result of the background computation (<parameters, progress, result>). In our case, the String input is the URL to retrieve the XML file, and the String result is the XML code in the file. The reading of the XML file from the specified URL is done as a background task in the doInBackground method that uses other private methods that open the HTTP connection and read the byte streams (saveXmlInString and readStream). Take a look at the doInBackground and saveXMLInString...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}