thesaurus logo
Mobile Development


By on April 12, 2017

Hello guys! Good day to you all. Today I will be doing a very brief introduction on Thesaurus and i will teach you how to integrate that with your mobile application.

We were given a coursework for our Android Development Module where we had to create a simple schedule application. In the specification we were asked to integrate a thesaurus web service with our app so that the user can enter a word in a text box to find out the synonyms related to that word. And we had been instructed to use thesaurus service by altervista (


Thesaurus is a reference work that lists words grouped together according to similarity of meaning in contrast to a dictionary.

Now that we know what the heck thesaurus means, let’s start the tutorial.

Step 01

Firstly, you need to obtain a key to use the service. You have the option to use either your facebook,google or yahoo account to subscribe to the service.

Once you’re done you will receive your own api key. You need this for the XML parsing.

If you want to test what the returned XML looks like copy the URL below and run it on your browser. You will be able to see the synonyms related to the word “peace”.



Note that this is only a temporary test key and you have to replace the test_only part of the URL with your own key.



Step 02

Clone my repository to your local computer and open up the project in Android Studio.



I won’t be posting the whole code here since it is extremely long but I will try to point out the important pieces in the code.


In the “ThesaurusActivity” class I’ve specified a constant called THESAURUS_KEY.

Replace the YOUR THESAURUS KEY text with your own key that you obtained from the website.


“ThesaurusXMLPullParser” class deals with all the XML transactions that goes down and if you closely examine the following code snippet you could easily identify how the data is extracted from the returned XML.
Screen Shot 2017-04-23 at 02.03.35

The XML file is being read inside the while loop. So depending on the XML you receive you just have to manipulate the code inside this while loop. Thesaurus by altervista always returns XML files with the same exact structure but if you want to use a different service provide you can easily do that and change the download URL in the Async Task and changing the while loop in the Pull Parser class.


So that’s about it guys. You will definitely think of a better way to use the service than just using a text box. If you did please let me know in the comments below.

I hope you enjoyed the tutorial and as always thanks for tuning in to my blog.

I will be  back with another tutorial soon and till then stay safe. With ❤️ Brion.

Kalamulla, SRI LANKA

My name is Brion Mario. And I am a Developer/ Musician/ Designer/ Entrepreneur/ Blogger from Sri Lanka. I'm a Software Engineering undergraduate at University of Westminster. I enjoy writing very much and please tag along and read my journey......

Follow me on Twitter