Definary


Lately I have been planning on preparing for the GRE test. This app is a direct result of procrastination. This is a simple dictionary app that sends http request to Aonaware, reads WordNet's html return and parses it using JSoup. It was also a good time to  experiment with Splash screen.





Variable declaration:

EditText editText = (EditText) findViewById(R.id.editText1);
request = editText.getText().toString();

Data extraction:

doc = Jsoup.connect("http://services.aonaware.com/DictService/Default.aspx?action=define&dict=wn&query=" + request).get();
Elements info = doc.select("span#lblDefinition");
String html = info.toString();
doc = Jsoup.parse(html);
result = doc.body().text();

Aesthetics:

// ................ //
finalresult = finalresult.trim().replaceAll("adj 1:", "\n\nAdjective\n* ");
finalresult = finalresult.trim().replaceAll("v 1:", "\n\nVerb\n* ");
finalresult = finalresult.trim().replaceAll("adv 1:", "\n\nAdverb\n* ");
finalresult = finalresult.trim().replaceAll("n :", "\n\nNoun\n* ");
finalresult = finalresult.trim().replaceAll("adj :", "\n\nAdjective\n* ");
// ................ //