Tuesday, August 23, 2016

Popular Movies App: A Technical Look

After several weeks and many hours of work, it's complete: my first Android app for the Udacity Nanodegree. It's been a steep learning curve coming from iOS with no prior Java knowledge, but the project's challenges have made its completion even more rewarding.

As much as I enjoy the accomplishment, the journey has been the most important part. From reading the specification to receiving the code review, the last two months have been a great experience. The finished project isn't just a completed app, but a culmination of technical skills that demonstrate the Android framework, and what its developers, can do. This post showcases a few of the more interesting aspects of the Popular Movies app, how I chose to implement them, and the challenges faced along the way. 





The User Interface

According to the specification, the project displays a grid of posters for movies that are currently popular or highly rated among viewers. Tapping on a movie shows a screen that includes details such as release data, average rating, trailers, and reviews. There's also an option to mark a movie as a "favorite" for offline viewing.


When looking for movies, people are generally searching for a specific type, so in addition to the options to view "popular" and "top rated" movies, I also allow users to filter by genre. The number of available genres wouldn't be suitable for a tab-based layout or a spinner, so the filtering options are shown in a navigation drawer. 


Genres can be selected from the navigation drawer.

The actual movies themselves were displayed without borders, in a GridView. The image thumbnails also have text containing the movie's title. 


The details page is where things get interesting. It primarily consists of LinearLayouts and is designed for vertical scrolling. For version 2 of the project, I was required to display trailers and reviews for the selected movie. Although the built-in views are suitable for displaying this data, reusing multiple views would make the coding process much easier. For this reason, I created a compound view by subclassing view groups. Doing so allowed the reuse of multiple views, simplifying the code, without compromising the visual appearance. 



Custom views for trailers and reviews.

The Data Model


Data for the app is supplied by The Movie Database API. While I initially used standard HttpUrlConnections for version 1 of the project, part 2 demanded more requests than simply fetching movies. The first code review suggested I try the Retrofit library to help with networking, but because of its simplicity, I opted to use Volley for this project instead.

The data model was another important aspect of the user experience. By tapping the "favorite" button, movies would be saved to the device storage for offline viewing.

Although the requirements only asked for the movie data to be stored, I thought it would be the best experience to also persist trailers and reviews. That way, this information would still be available if the connection was offline, since no additional downloads would be required.

Each movie can have multiple trailers and multiple reviews, so this task is best solved with a relational database. Knowing the difficulty of working with raw SQLite, I decided to implement the data model using GreenDAO. The library had a few nuances making it more difficult to work with than my previous experience with Apple's Core Data, but it did its job well. I'm glad I gave it a try, though I intend to try out other ORM solutions before recommending its use.

The Challenges


Tackling a project of this scale is a challenge of its own, but there were a few specific challenges that I faced when building the app.

Because of the way Android manages the lifecycle of activities and fragments, they can be destroyed and recreated several times during the lifetime of an app. Events like rotating the device or moving an app to the background can cause these changes in the activity's lifecycle. As a result, it's important for developers to save and restore the UI state.

Doing so is a straightforward process but it's important to get it right. Because the app makes use of custom views, restoring these views' state is an added challenge. Saving and restoring each fragment can be tedious at times, but it's definitely worth it to provide the best user experience.

Another consideration in producing a quality app is handling edge cases. Because I wanted to persist movies and trailers along with the movie data, the potential for additional bugs was introduced. For example, a user could mark a movie as a "favorite" before the movies and trailers are downloaded. If the network were to go down before these downloads complete, the app would need to remember to download this data next time the network is available. These scenarios don't always happen, but when they do, a high quality app should handle them accordingly.

A final challenge involved adapting the UI for tablets with the master-detail flow. The two pane layout works well in landscape but most tablets in portrait mode don't have enough screen space. For the alternate, portrait mode layout, I took a less conventional approach, displaying the detail view as a popover. Perhaps it won't be the next UI design craze, though I still think it's an interesting solution to for two-pane layouts in portrait mode. Implementing it this way, the detail fragment can be reused across orientation changes, since it won't be tied to a separate activity like in the phone layout. 



The details page on a tablet in portrait mode.

Overall it was an incredible learning experience and the end product turned out great. In just 2 months, the great folks at Udacity took me from no Java knowledge to building a polished Android app. It's been an excellent journey so far and I can't wait to see what comes next.

93 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Hey, that's a nice post. Good work :)

    ReplyDelete
  3. Thanks for sharing nice information with us. i like your post and all you share with us is uptodate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job. DVD

    ReplyDelete
  4. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. Tech Tricks

    ReplyDelete
  5. I am happy to find this post very useful for me, as it contains lot of information. I always prefer to read the quality content and this thing I found in you post. Thanks for sharing. UC mini for android

    ReplyDelete
  6. I am happy to find this post very useful for me, as it contains lot of information. I always prefer to read the quality content and this thing I found in you post. Thanks for sharing. Download 9apps

    ReplyDelete
  7. I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing.
    Allucfree

    ReplyDelete
  8. The blog is a spotlight for individuals, A blog that is so pure, lucky to read it.
    holm law group san diego

    ReplyDelete
  9. Thank you for taking the time to publish this information very useful! free movies online hd

    ReplyDelete
  10. Thank you a bunch for sharing this with all of us you actually realize what you are talking about! Bookmarked. Please also seek advice from my site =). We could have a hyperlink change contract between us! 123movies

    ReplyDelete
  11. Thank you for helping people get the information they need. Great stuff as usual. Keep up the great work!!! ACMarket

    ReplyDelete
  12. Can’t get over the fact that words can be used this beautifully.
    click here

    ReplyDelete
  13. I really loved reading your blog. It was very well authored and easy to understand. Unlike other blogs I have read which are really not that good.Thanks alot! Cydia Impactor

    ReplyDelete
  14. I am very much pleased with the contents you have mentioned. I wanted to thank you for this great article. iFile iOS 11

    ReplyDelete
  15. An essential hotspot for the gathering of people that makes the peruser stride by step.
    source

    ReplyDelete
  16. Just admiring your work and wondering how you managed this blog so well. It’s so remarkable that I can't afford to not go through this valuable information whenever I surf the internet! Download iOS 11.3

    ReplyDelete
  17. Click on a Online free full movies and you will get information about the movie along with the link for streaming. This is the website that you should try first. This online free full movies website is one of its kinds and that’s the reason we have listed it in list of free movies streaming sites. Moreover, there are more than 7 mirrors obtainable for free movie streaming which are sorted on this basis of user rating. It is one of helpful feature of this free movie website which is very handy. . This movie site is not having cluster of pop ads. So, you can enjoy this movie website without an issue and can enjoy free movies without any problem.

    ReplyDelete
  18. I can't clarify the emotions I had while perusing this blog. I was totally entranced.
    https://123movieshub.it/

    ReplyDelete
  19. There was a time, in the not so distant past, when a trip out to your local video store with the family was a weekly or monthly treat. Watch The 100 free online

    ReplyDelete
  20. Best work you have done, this online website is really cool with great facts. vidmate apk

    ReplyDelete
  21. Great post, and great website. Thanks for the information! best edm mastering

    ReplyDelete
  22. I am making a full length motion picture, and I am searching for financial specialists. The monetary allowance is just $100,000, and you can contribute as meager as $5000. I am putting my own cash in the film. Movies

    ReplyDelete
  23. The open air film generation organization you pick ought to have a screen estimate perfectly for your terrace flick night. The organization ought to likewise have the capacity to furnish you with a projector and sound hardware to make your film night an exceptional, peaceful affair much like a drive-in motion picture or motion picture theater. 123movies

    ReplyDelete
  24. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work the good fight season 2

    ReplyDelete
  25. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. buy dvd mr. mercedes season 1

    ReplyDelete
  26. Im no expert, but I believe you just made an excellent point. You certainly fully understand what youre speaking about, and I can truly get behind that. watch thank you for your service online free

    ReplyDelete
  27. Movieflix is the newest entertainment mobile movie apps where you can watch unlimited HD Free Movies and Series online and movie box,mobile app

    ReplyDelete
  28. This is my first time i visit here. I found such a substantial https://movgotv.com/movies/ number of interesting stuff in your blog especially its examination. Really its inconceivable article. Keep it up.

    ReplyDelete
  29. On the off chance that there are kids on the house and you need to invest some family energy watching movies together, you may look for the appropriate movie online. all movies free online

    ReplyDelete
  30. Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Fabulous post. Thanks a ton for sharing your knowledge! It is great to see that some people still put in an effort into managing their websites. I'll be sure to check back again real soon. myla sinanaj

    ReplyDelete
  31. Thanks for another wonderful post. Where else could anybody get that type of info in such an ideal way of writing? film streaming

    ReplyDelete
  32. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. Bogobeats

    ReplyDelete
  33. This comment has been removed by the author.

    ReplyDelete
  34. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. gomovies

    ReplyDelete
  35. Wow, incredible blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your web site is wonderful, as well as the content! 123movies

    ReplyDelete
  36. I’m excited to uncover this page. I need to to thank you for ones time for this particularly fantastic read !! I definitely really liked every part of it and i also have you saved to fav to look at new information in your site.
    123 movies

    ReplyDelete
  37. I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! https://spider-manfarhomefull.com/

    ReplyDelete
  38. A sumptuous blog, honestly. Valued each and every piece of it.
    Pinoy Teleserye Replay

    ReplyDelete
  39. Hello, I have browsed most of your posts. This post is probably where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject. fmovies

    ReplyDelete
  40. Excellent to be visiting your blog again, it has been months for me. Rightly, this article that I've been served for therefore long. I want this article to finish my assignment within the faculty, and it has the same topic together with your article. Thanks for the ton of valuable help, nice share. film streaming

    ReplyDelete
  41. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article.
    jadwal film bioskop

    ReplyDelete
  42. Excellent information on your blog, thank you for taking the time to share with us. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. it chapter 2 stream

    ReplyDelete
  43. Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. 123movies

    ReplyDelete
  44. Hi there! Nice post! Please tell us when I will see a follow up! click for more info

    ReplyDelete
  45. Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. How To Stream Frozen 2 (2019)

    ReplyDelete
  46. I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up. hdfilme.cc

    ReplyDelete
  47. Thanks for the blog loaded with so many information. Stopping by your blog helped me to get what I was looking for. indoxx1

    ReplyDelete
  48. I love the way you write and share your niche! Very interesting and different! Keep it coming! app development company

    ReplyDelete
  49. Great content material and great layout. Your website deserves all of the positive feedback it’s been getting. filmyzilla

    ReplyDelete
  50. Thanks for picking out the time to discuss this, I feel great about it and love studying more on this topic. It is extremely helpful for me. Thanks for such a valuable help again. cimalight

    ReplyDelete
  51. Im no expert, but I believe you just made an excellent point. You certainly fully understand what youre speaking about, and I can truly get behind that.
    dvds

    ReplyDelete
  52. It would not be reasonable in the event that we compliment all the blog compositions yet not the creator. Incredible Work!
    123 movies

    ReplyDelete
  53. Please continue this great work and I look forward to more of your awesome blog posts. https://t.me/s/disneyplusaccountgenerator

    ReplyDelete
  54. Don’t focus on having a great blog. Focus on producing a blog that’s great for your readers.
    https://t.me/s/tindergoldfree2020
    https://t.me/s/tindergoldfree
    http://online.fliphtml5.com/lwlii/uwfj/
    https://www.teamapp.com/clubs/531861

    ReplyDelete
  55. If you are looking for more information about flat rate locksmith Las Vegas check that right away. dubbed anime

    ReplyDelete
  56. There are no greater treasures than the highest human qualities such as compassion.
    https://t.me/s/freenetflixgiftcode,
    https://www.teamapp.com/clubs/532249,
    https://marketplace.visualstudio.com/publishers/Netflix-Gift-Codes-Generator-2020,
    http://fliphtml5.com/pnzna/ppwh

    ReplyDelete
  57. This bit of blog shows commitment of essayist.
    ดูหนัง

    ReplyDelete
  58. Finally reached the Apex of Standardized Suckitude.
    https://www.ulule.com/chaturbate-free-tokens/#/badges/,
    https://www.bizcommunity.com/Profile/ChaturbateFreeTokensHackOn,
    https://marketplace.visualstudio.com/publishers/HackChaturbateCheatFreeTokens2020,
    https://teespring.com/chaturbate-hack-free-toke?pid=371&cid=6547

    ReplyDelete
  59. People can find it quite beneficial for themselves to download flicks at their homes without having to spend unnecessary money on highly priced DVD movies that can either be bought or rented from retail shops. 123movies.to new site

    ReplyDelete
  60. Getting to Know You - If watching movies is your thing now, movies 123 why not start from the beginning? Each of you chooses your own favorite movie from when you were a child and watch them together.

    ReplyDelete
  61. I think this is one of the most significant information for me. And i’m glad reading your article. But should remark on some general things, The web site style is perfect, the articles is really great : D. Good job, cheers try this

    ReplyDelete
  62. Wonderful blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it. 토토사이트

    ReplyDelete
  63. Gambling can be fun, but it’s designed to part you from your hard-earned cash.party supplies melbourne eastern suburbs

    ReplyDelete
  64. I am unable to read articles online very often, but I’m glad I did today. This is very well written and your points are well-expressed. Please, don’t ever stop writing. 메이저사이트

    ReplyDelete
  65. Great post, you have pointed out some fantastic points , I likewise think this s a very wonderful website. click here

    ReplyDelete
  66. Someone Sometimes with visits your blog regularly and recommended it in my experience to read as well. The way of writing is excellent and also the content is top-notch. Thanks for that insight you provide the readers! 토토커뮤니티

    ReplyDelete
  67. Here at BUY Packaging Boxes, we specialize in Custom Packaging Boxes<a href="http://www.buypackagingboxes.co.uk/product/double-wall-tuck-top/http://www.buypackagingboxes.co.uk/product/double-wall-tuck-top/</a>

    ReplyDelete
  68. Keep up the good work , I read few posts on this web site and I conceive that your blog is very interesting and has sets of fantastic information. Lifeguard recertification

    ReplyDelete
  69. This is a truly good site post. Not too many people would actually, the way you just did. I am really impressed that there is so much information about this subject that have been uncovered and you’ve done your best, with so much class. If wanted to know more about green smoke reviews, than by all means come in and check our stuff. 토토사이트

    ReplyDelete
  70. A very excellent blog post. I am thankful for your blog post. I have found a lot of approaches after visiting your post. 릴게임

    ReplyDelete
  71. I am unable to read articles online very often, but I’m glad I did today. This is very well written and your points are well-expressed. Please, don’t ever stop writing. 먹튀사이트

    ReplyDelete
  72. Wonderful blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Appreciate it. 먹튀검증

    ReplyDelete
  73. The source of the best online slot games It comes in the form of famous anime from Japan such as One Piece, Naruto.สมัคร PG Slot

    ReplyDelete
  74. I have seen some great stuff here. Worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website. Your work is truly appreciated around the clock and the globe. 88카

    ReplyDelete
  75. Keep up the good work , I read few posts on this web site and I conceive that your blog is very interesting and has sets of fantastic information. 먹튀검증

    ReplyDelete
  76. Sports wagering can definitely provide extreme fun and excitement to those passionate about sports as well as the serious bettors finding a way to make smart money. Before one embarks on sports betting, it would be wise to understand the basic of sports betting. 토토사이트

    ReplyDelete
  77. This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post.! 토토사이트

    ReplyDelete
  78. Wow, What an Outstanding post. I found this too much informatics. It is what I was seeking for. I would like to recommend you that please keep sharing such type of info.If possible, Thanks. 파워볼사이트

    ReplyDelete
  79. As a seller of legal steroids, you can buy Crazy Bulk products, explore stacks and finally get the body you’ve always wanted tafsir ahlam

    ReplyDelete
  80. They normally need to shop it around to sell it. That has been my own experience up until now. I've never made substance with a movie appropriation bargain set up.
    filmy4wep

    ReplyDelete
  81. Shipping from China to Us Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. Shipping from China to Usa

    ReplyDelete
  82. The main inquiry film financial backers and movie wholesalers pose is who the cast is. amazon.commytv

    ReplyDelete
  83. I love the way you write and share your niche! Very interesting and different! Keep it coming! 대전마사지

    ReplyDelete
  84. Liposuction is possible in almost any area of the body. Many of our patients opt to target more than one area of the body during their liposuction procedure because we offer discounts for multiple target areas. cosmetic surgery

    ReplyDelete
  85. You have beaten yourself this time, and I appreciate you and hopping for some more informative posts in future. Thank you for sharing great information to us. 바둑이게임

    ReplyDelete
  86. This is also a very good post which I really
    enjoyed reading. It is not every day that I have the possibility to see
    something like this.. interpretation of the dream

    ReplyDelete
  87. This is also a very good post which I really
    enjoyed reading. It is not every day that I have the possibility to see
    something like this.. Hero Academia Manga

    ReplyDelete
  88. I truly use them on an especially central level confusing parts : you will see these individuals during: https://visualaidscentre.com/

    ReplyDelete