Insider's Guide To Udacity Android Developer Nanodegree
Written by Nikos Vaggalis   
Monday, 20 March 2017
Article Index
Insider's Guide To Udacity Android Developer Nanodegree
Building an Android UI
Getting Help From Mentors

Asking for Help

If you've been an astute student so far, you ought find no difficulty with the project. But in case things don't turn out as expected and you feel in need of additional help, or just want to ask a question, this is where your dedicated Mentor steps in.

I've communicated with mine, Dianne, on several occasions, especially when in need to clear up some grey areas regarding the project. She was quick in getting back to me with really helpful and satisfactory answers:

Nikos: In the specs of the MovieDB project it states that

"At this point, you should have a working understanding of recreating activities using onSaveInstanceState"

To what is it referring to?

Dianne: That is referring to your application being expected to handle orientation change without crashing. Some device configurations can change during runtime (such as screen orientation, keyboard availability, and language). When such a change occurs, Android restarts the running Activity (onDestroy() is called, followed by onCreate()).

Basically the activity goes through the entire lifecycle again whenever the screen orientation changes. We use onSaveInstaceState to restore our app to whatever state it was in (for example which list item is selected, etc.) from before the change.

Nikos: What I was thinking was the following scenario: activity "main" displays the list of the movies' posters and saves the recycler layout, adapter and contents into the activity's bundle. Then after choosing a certain movie, the "detail" activity appears.After the user navigates back to the main activity, the recyclerview with its layoutmanager, adapter and contents is restored from the bundle.

On the other case that you just save the layoutmanager into the bundle, what happens with the contents which will have to be created afresh?

Dianne: To summarize the default behaviour for activities and tasks:

When Activity A starts Activity B, Activity A is stopped, but the system retains its state (such as scroll position and text entered into forms). If the user presses the Back button while in Activity B, Activity A resumes with its state restored.

So the navigation from the detail to main activity using the back button would just return the user to the main activity's last state. It's the default behavior

As for your other question, the contents and the movies should not refresh each time.

Like I said, really helpful and to the point.

But answering questions is not the only task that burdens a Mentor. Dianne's main assignment is to come up with a personalized learning plan based on my needs as well skillset, keeping me focused, motivated and on schedule. For the latter we utilize weekly check-ins, where she asks :  

"What are your goals for the coming week? Are you currently stuck on anything?"

This bi-directional communication proved extremely valuable to me as after successfully completing stage 1 of the project, I relaxed and wasn't feeling like getting back to studying any time soon.Thankfully her weekly check-in brought me back to reality, preventing a potential derailment!

However, if you don't feel like bothering the mentor, or when your questions are either too broad, or in need of immediate feedback, then head into the forums where you can post any kind of questions ranging from concerns about the project to the Java language:

Nikos: Is it possible to replace the inner AsyncTaskLoader class with a lambda expression?

    public Loader<String> onCreateLoader(int i, final Bundle args) {
        return new AsyncTaskLoader<String>(this) {
            protected void onStartLoading() {
                if (args==null) {

Dagger,Forum Mentor: Yeah it sure can be replaced by lambdas.I think that you can take a look at the following stackoverflow post to see how it's done:

Java 8, Lambda : replace Anonymous inner class by lambda

Though you will have to enable Java 8 if you want to use lambdas. Take a look at the Android dev site for a quick tutorial on enabling it

Alex,Forum Mentor: There's also Retrolambda if you don't want to move to Java 8. Also works great in conjunction with RxJava if you're interested in that!

Dagger,Forum Mentor: Hey @nikos, did you try to take a look at RetroLambda as @Alex mentioned? It automatically checks and offers you option to convert a method to its Lambda equivalent (similar to Lint).

Alternatively here is a good guide on understanding the implementation of Lambdas, which you can refer to and then try converting the inner return statement by yourself:Using Java 8 Lambda expressions in Android

Alex,Forum Mentor: As @dagger mentioned though I would definitely give retrolambda a try, it's very easy to use and takes care of most everything for you. Also worth noting that you don't have to use lambdas at all if you don't want to, they are convenient and save some code typing but it's not a huge deal if you don't want to use it or don't have the time to invest in learning about it right now.

Note, that the answers came back almost in real time, as the experienced forum mentors literally lurk in the forum's shadows to snatch up any kind of questions.

Back to the Project and Feedback

But back to the project for more details.Basically what you have to do is make an application that lets your users see a list of the top rated or the most popular movies, by means of constructing a URL that will be used to call into the MovieDB service and retrieve the results as an array of JSON objects, which you have to parse and convert to their equivalents in Java.

You then bind this array, or alternative data structure, to an adapter and that adapter in turn to a RecyclerView responsible for displaying a list of the movies' posters which are contained in the Java objects themselves.To render the pictures you use the Picasso library.

You also have to take care of exceptions and utilize the onSaveInstanceState() in order to pack that object collection into a ParcelableArray object that survives the main Activity's deaths, courtesy of the device rotating, so that when the activity is summoned back to the world of the living, it is restored to its previously valid state by extracting the contents of this Parcelable object.

Clicking on a poster, should bring up the Details activity which contains further details on the chosen movie, such as its release date, rating, short overview etc.



Finally, the project must conform to both the general quality guidelines and to stage 1's Evaluation Rubic.If you've met both of them then you're good to go with the second part of the project.

Code Review

The best part that follows the project's submission and within 24 hours, is that is being code reviewed by an expert Udacity reviewer who does a thorough job in describing where you went good or bad, pointing to valuable resources in order for you to make the improvements necessary to advance your coding skills to the next level.



This brings us to the end of this journal's first pages on my experience with the Android Developer Nanodegree. So far it has been very promising, which sets the bar even higher for what's to follow.


android cert


More Information

Android Developer Nanodegree

Related Articles

Associate Android Developer Certification by Google

Artificial Intelligence Engineer Nanodegree From Udacity

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.





raspberry pi books



or email your comment to:

Last Updated ( Thursday, 23 July 2020 )