thesaurus & dictionary > Support > Launch the online dictionary Android app via an Intent?

Search

User Post
Robert Nekic
3 post(s)


I love the ability to launch the single-language offline dictionary apps via an Android intent with the word to look-up in the extras.  Is it possible to launch the multi-language online app in this manner?  Does it accept a language value in the Intent extras?  If so, what is the name of the extra it expects to contain the language code?

Thanks!



05-Sep-14, 22:32:24 Rispondi | Citazione | Report spam
admin
134 post(s)


Web site
The online dictionary is not designed to be launched via intent.

The Intent.ACTION_SEARCH includes only the SearchManager.QUERY extra, as described in the Android developer guide:

http://developer.android.com/reference/android/content/Intent.html#ACTION_SEARCH



06-Sep-14, 12:45:40 Rispondi | Citazione | Report spam
Robert Nekic
3 post(s)



Hi, thanks for the fast reply.

True, but it's simple enough to send other values in the intent with Intent.putExtra(String, String).

http://developer.android.com/reference/android/content/Intent.html#putExtra(java.lang.String, java.lang.String)


Something like this could work, no?   As long as you document the language extra you are expecting:

Intent intent = new Intent(Intent.ACTION_SEARCH); 
intent.setPackage("livio.dictionary"); 
intent.putExtra(SearchManager.QUERY, word);
intent.putExtra("langauge", "it_IT");


Anyway, just a suggestion. Thanks for the nice apps!



08-Sep-14, 16:37:54 Rispondi | Citazione | Report spam
Robert Nekic
3 post(s)


Oops, I suppose technically the extra should include the package name.  So, something like 

intent.putExtra("livio.dictionary.Langauge", "it_IT");





08-Sep-14, 16:46:59 Rispondi | Citazione | Report spam
admin
134 post(s)


Web site
Good idea, but as I already wrote the online dictionary is not designed for this.
May be that in a future release I'll add your request to the online dictionary, but currently the focus is on the offline dictionaries.
Thanks for your suggestion.


08-Sep-14, 19:35:35 Rispondi | Citazione | Report spam
admin
134 post(s)


Web site
The Android online dictionary will support the launch via intent in release 2.6.
The following code can be used as template:

        String word = "pace";
        Intent intent = new Intent(Intent.ACTION_SEARCH);
        intent.setPackage("livio.dictionary");
        intent.putExtra(SearchManager.QUERY, word);
        intent.putExtra("language", "it_IT");
        if (isIntentAvailable(this, intent))
            startActivity(intent);
        else Log.d("HelloWebView", "Intent is not available!");


04-Oct-14, 15:51:02 Rispondi | Citazione | Report spam