[Free] Dictionary Extension : Developing Dictionary apps made Easy!

Ur wish man !

I think @TIMAI2 asked you that if he enters English as the language param, and स्वच्छ as the word, will your extension return clean or give an error?

It will return word not found

As an error

Ok, thanks

thank you for your contribution...
please follow the naming conventions and adjust your extension accordingly



Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

1 Like

Thank you @Taifun I will change the spellings soon !

Extension is now free and latest aix's will be uploaded soon


Now a great extension :ok_hand:

1 Like

Thank you @Kumaraswamy

1 Like

Can you add the parameter of "Spell of Word (Audio)" to the extension?

1 Like

Yes I can do it @Kumaraswamy

Hi, Rudra
Important Message
Can I use your extension for app submitted to MIT App Inventor Appathon for Good 2021
Please Reply.
Thank You


I posted this extension from another Account, now I abandoned it :laughing:

Anyways :

I, Anshuman aka Rudra, allow to republish the extension as part of the project file for the purposes of the MIT App Inventor Appathon 2021.

1 Like

Thank You So Much

1 Like

Best of luck for Appathon, waiting to see your app :upside_down_face:

1 Like

Thank You...

1 Like

Can You Give The example .aia file for this extension
because it is not working for this is my code:

and My Design Section

Sure ! :grin:
wait a minute :relaxed:

1 Like

Can You please send the .aia file

dictionary.aia (12.1 KB)

Also, I thought to make it Open source so :

package com.kab.Dictionary;

import android.os.AsyncTask;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;

        version = 1,
        category = ComponentCategory.EXTENSION,
        nonVisible = true

@SimpleObject(external = true)
public class Translator extends AndroidNonvisibleComponent {

    public Translator(ComponentContainer container) {

    public void Translate(String sourceLanguage, String textToTranslate) {
        API api = new API(sourceLanguage,textToTranslate);
        api.setTranslateListener(new API.TranslateListener() {
            public void onSuccess(List<String> Synonyms, List<String> Definition, List<String> partsOfSpeech, List<String> Sentence) {
                List<String> synonyms = new ArrayList<String>();
                String synonym = "";
                for (i : Synonyms) {
                synonym = i.replace("(","");
                synonym = synonym.replace(")","");
                List<String> definitions = new ArrayList<String>();
                String definition = "";
                for (x : Definition) {
                definition = x.replace("(","");
                definition = synonym.replace(")","");
                List<String> partsofspeech = new ArrayList<String>();
                String partOfSpeech = "";
                for (v : partsOfSpeech) {
                partOfSpeech = v.replace("(","");
                partOfSpeech = partOfSpeech.replace(")","");
                List<String> sentences = new ArrayList<String>();
                String sentence = "";
                for (c : Sentence) {
                sentence = c.replace("(","");
                sentence = sentence.replace(")","");
                GotResponse(synonyms, definitions, partsofspeech, sentences);

            public void onFailure(String ErrorText) {

    public void GotResponse(List<String> Synonyms, List<String> Definitions, List<String> PartsOfSpeech, List<String> Sentences) {
        EventDispatcher.dispatchEvent(this, "GotResponse", Synonyms, Definitions, PartsOfSpeech, Sentences);

    public void Failed(String error) {
        EventDispatcher.dispatchEvent(this, "Failed", error);

    private static class API {

        public API(String langFrom,String text) {
            Async async = new Async();

        class Async extends AsyncTask<String, String, String> {
            protected String doInBackground(String... strings) {
                String resp = null;
                final String url;
                try {
                    url = "https://api.dictionaryapi.dev/api/v2/entries/" + strings[0] + "/" + URLEncoder.encode(strings[1], "UTF-8");
                    URL obj = new URL(url);
                    HttpURLConnection con = (HttpURLConnection) obj.openConnection();
                    con.setRequestProperty("User-Agent", "Mozilla/5.0");
                    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
                    String inputLine;
                    StringBuffer response = new StringBuffer();
                    while ((inputLine = in.readLine()) != null) {
                    resp = response.toString();
                } catch (Exception e) {
                return resp;

            protected void onPreExecute() {

            protected void onPostExecute(String result) {
                String temp = "";

                if (result == null) {
                    listener.onFailure("Network Error");
                } else {
                    try {
                        JSONArray mainData = new JSONArray(result);
                        JSONObject mainObject = (JSONObject) mainData.get(0);
                        JSONArray meanings = (JSONArray) mainObject.get("meanings");

                        List<String> partsOfSpeech = new ArrayList<>();
                        List<String> definitions = new ArrayList<>();
                        List<String> synonyms = new ArrayList<>();
                        List<String> sentences = new ArrayList<>();

                        for (int i = 0; i < meanings.length(); i++) {
                            JSONObject pos = meanings.getJSONObject(i);

                            JSONArray tempDef = pos.getJSONArray("definitions");

                            for (int j = 0;j < tempDef.length(); j++) {
                                JSONObject object = (JSONObject) tempDef.get(j);
                                if (object.has("definition")) {
                                    String def = object.get("definition").toString();
                                if (object.has("synonyms")) {
                                    JSONArray syn = (JSONArray) object.get("synonyms");
                                    for (int k = 0; k < syn.length(); k++) {
                                if (object.has("example")) {
                                    String eg = object.get("example").toString();

                        listener.onSuccess(synonyms, definitions, partsOfSpeech, sentences);

                    } catch (Exception e) {

            protected void onProgressUpdate(String... values) {

            protected void onCancelled(String s) {

        private TranslateListener listener;

        public void setTranslateListener(TranslateListener listener) {
            this.listener = listener;

        private interface TranslateListener {
            public void onSuccess(List<String> Synonyms, List<String> Definition, List<String> partsOfSpeech, List<String> Sentence);

            public void onFailure(String ErrorText);