java - how to get dictionary meaning from direct to web android -
this main activity code. kind of jumble solver program. jumble helper create solve unjumble word. when enter unordered word gives correct dictionary word.
currently when tap on word text converted in voice (tts api) instead of want open dictionary meaning.
now want add dictionary meaning web dictionary.. how can add word meaning?? note call data unix word dic.
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); edt_char = (edittext) findviewbyid(r.id.edittext); wordlistview = (listview) findviewbyid(r.id.word_listview); wordlistview.setonitemclicklistener(this); tts = new texttospeech(getapplicationcontext(), new texttospeech.oninitlistener() { @override public void oninit(int i) { if (i != texttospeech.error) { tts.setlanguage(locale.english); } } }); copydbfileonlyonce(); } public void viewonclick(view button) { switch (button.getid()) { case r.id.btnget: string word = edt_char.gettext().tostring(); if (!"".equalsignorecase(word) && resourceutil.supportedwordformat(word)) { new datadictionarytask(this, wordlistview).execute(alphabettoprime.calcprimeproduct(word.tolowercase())); } else { ((view)(wordlistview.getparent())).setvisibility(view.gone); toast.maketext(getapplicationcontext(), "please enter a-z characters only", toast.length_long).show(); } hidesoftkeyboard(this); break; } } @override public void onconfigurationchanged(configuration newconfig) { super.onconfigurationchanged(newconfig); setcontentview(r.layout.activity_main); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { return super.onoptionsitemselected(item); } @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { string spk = (string)parent.getitematposition(position); log.d("selected text:", spk); tts.speak(spk, texttospeech.queue_flush, null); } private void copydbfileonlyonce() { prefs = getsharedpreferences("jumblehelper_pref", mode_private); if (prefs.getboolean("firstrun", true)) { new assetloader(this).execute("jumblehelper.db3"); prefs.edit().putboolean("firstrun", false).commit(); } } public static void hidesoftkeyboard(activity activity) { inputmethodmanager inputmethodmanager = (inputmethodmanager) activity.getsystemservice(activity.input_method_service); inputmethodmanager.hidesoftinputfromwindow(activity.getcurrentfocus().getwindowtoken(), 0); } }
Comments
Post a Comment