DEV Community

Kuan Peng
Kuan Peng

Posted on • Updated on

So You Think You Know Kpop (Android App)

Summary

Built a celebrity guessing app as part of clip #84 of The Complete Android 8.0 Oreo Developer Course by Rob Percival and Nick Walter.

The goal of this exercise was to practice downloading things from the internet using AyncTask (which is actually deprecated...).

Deviated somewhat from the task at hand as the website used in the course is no longer available. So I drew inspiration from Kpop.

Code

GitHub logo kuanp / SoYouThinkYouKnowKpop

Modified version of Guess The Celebrity

Screenshot

Alt Text

Main Challenge

The biggest challenge for this assignment is finding a website that has nice looking HTML to parse. I sourced content from https://kingchoice.me; this website contains a lot of "celebrity lists" with nice HTML.

For example: https://kingchoice.me/topic-hot-100-kpop-idols-rankings-2019-close-dec-31-1225.html

Alt Text

I also found it to be overly tedious to try to create a regex to search through HTML. After all, it's semi-structured information, so instead I used Jsoup to parse the HTML and get the elements I needed. Others may want to do the same. Tutorials: link

Additional interesting things of note

  • Used Java8; the stream / lambda paradigm is very powerful
  • Used Lombok; its EqualsAndHashCode capability is great for deduping objects.
  • Always fun to try to break the logic into many classes
  • Was too lazy to properly handle exceptions. Oh well...
  • Wonder how to use Futures or other concurrency features; pretty sure I locked UI thread while loading stuff for this one.

Top comments (0)