Android Open Source - prepGRE Etymology Retriever






From Project

Back to project page prepGRE.

License

The source code is released under:

MIT License

If you think the Android project prepGRE listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.abhimanbhau.prepgre.code;
//w w w. j  a  va  2  s  . c om
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import android.os.AsyncTask;

public class EtymologyRetriever extends AsyncTask<String, Void, String> {
  @Override
  protected void onPreExecute() {
  }

  @Override
  protected String doInBackground(String... arg) {
    String result = null;
    try {
      Document doc = Jsoup
          .connect(arg[0])
          .timeout(7000)
          .userAgent(
              "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36")
          .get();

      Elements elems = doc.getElementsByClass("highlight");
      if (elems.size() == 0) {
        return "No data received!";
      }
      for (Element e : elems) {
        result += (e.text());
      }
    } catch (Exception e) {
      return null;
    }
    if (result != null) {
      result = result.replace("null", "");
      return result;
    }
    return null;
  }
}




Java Source Code List

com.abhimanbhau.prepgre.code.EtymologyRetriever.java
com.abhimanbhau.prepgre.code.MnemonicRetriever.java
com.abhimanbhau.prepgre.code.Utility.java
com.abhimanbhau.prepgre.ui.AboutFragment.java
com.abhimanbhau.prepgre.ui.HomeFragment.java
com.abhimanbhau.prepgre.ui.MainActivity.java
com.abhimanbhau.prepgre.ui.NavigationDrawerFragment.java
com.abhimanbhau.prepgre.ui.SettingsActivity.java
com.abhimanbhau.prepgre.ui.WordListFragment.java