Skip to main content


After finishing some GRE quizzes that I downloaded a while ago, I wanted to have those with me so that I could review them again. Hence, this app. The app randomly chooses 1 of 50 quizzes. From that quiz, it chooses 1 of 100 questions. The app uses random number generators, Jsoup parser, AsyncTask and javascript.


 protected void onCreate(Bundle savedInstanceState) {
  webViewCanvas = (WebView) findViewById(;
  button = (Button) findViewById(;
  loadingScreen = (ImageView) findViewById(;
  AsyncTaskRunner shuffleForNewWord = new AsyncTaskRunner();


 private class AsyncTaskRunner extends AsyncTask<String, String, String> {

  private String word, answer, options;
  private String result;

  protected String doInBackground(String... params) {
   String file = "words_college_gre_words-quiz-" + randomQuiz()+ ".htm";
   InputStream greFiles = null;

   try {
    greFiles = getAssets().open(file);
    Document doc = Jsoup.parse(greFiles, "UTF-8","");
    Element selectedQuizQuestion = ("tr").get(randomQuestion()));
    String raw = selectedQuizQuestion.toString();
    //...............Editing raw to get result.......................//
    //.......Adding html, javascript, and pretty printing............//
    result = //getting result from above described process 
    //sending word to publishProgress to print it as Button label
    //doInBackground should have nothing to do with controlling UI/main thread
   } catch (IOException e) {

   finally {
    if (greFiles != null)
     try {
     } catch (IOException e) {
      // TODO Auto-generated catch block
   return result;

  protected void onPostExecute(String result) {
   //changing to transparent image once the result is ready
   webViewCanvas.loadData(result, "text/html", "UTF-8");

  protected void onPreExecute() {
   //making the webview color consistent 
   webViewCanvas.loadData("<html><body bgcolor=\"#8cdfff\"></html></body>","text/html", "UTF-8");

  protected void onProgressUpdate(String... text) {



Popular posts from this blog



The Zorganian Republic has some very strange customs. Couples only wish to have female children as only females can inherit the family's wealth, so if they have a male child they keep having more children until they have a girl. If they have a girl, they stop having children. What is the ratio of girls to boys in Zorgania?
The ratio of girls to boys in Zorgania is 1:1. This might be a little counter-intuitive at first. Here are some ways of tackling this problem. 1. Monte Carlo Simulation: Although, Monte Carlo simulation does not necessarily show why the result is 1:1, it is appropriate because of the very counter-intuitive nature of the problem. At the very least, it helps us see that the result is indeed 1:1. Therefore, this is a good start.
The following R code estimates the probability of a child being a boy in Zorgania. 
couples <-100000 boycount <-0for (i in1:couples){ # 0: boywhile (sample(c(0,1),1) ==0) { boycount=boycount+1 } } probability <- boycount/(co…

Simple Launcher

A simple minimal launcher application for Android devices that shows battery percentage using lzyzsd's CirclProgress library (ArchProgress used in this case) and BroadcastReciever for battery state, Android's clock widgets, a built-in flash light switch and an app list view that can be toggled. Currently, the toggle simply filters all the app that I am working on at present. Future implementation can allow users to select their favorite apps or populate second toggle based on the most used applications.