Overview
Applications, e.g. ebook readers and word games, may leverage on dictionary language packs to show the definitions of words. You as Android developer may send a request from your Android application to the language pack in order to retrieve the meaning of a word and show the definition to the end user. The request has to be sent via a specific intent towards the language pack. Your application has to create an intent with an action equal to Intent.ACTION_SEARCH, using the package name of the target language pack and adding the word to look for as extended data (SearchManager.QUERY) to the intent. The following language packs are available in the Android Market:
Example
Here is an example to show italian definitions. Make sure to install the latest version of the italian language pack on your Android device. General documentation about developing Android applications is available in Android Developers web site. Let's start by some useful imports:
import android.content.ActivityNotFoundException;
Now we create an intent to retrieve the meaning of word 'pace':
String word = "pace";
Note that in case the intent is not available, you may insert a dialog suggesting the end user to download the language pack. |