Skip to content

Latest commit

 

History

History
123 lines (91 loc) · 4.92 KB

Review_Questions.md

File metadata and controls

123 lines (91 loc) · 4.92 KB

Android Review Questions

What is the default build system for Android apps?

The default build system for Android is Gradle. It fetches dependencies for you and can build multi-module applications. (Much) Older build systems include Maven and Ant, while companies like Uber use Buck.

What is the AndroidManifest?

AndroidManifest.xml is a required file for all Android apps. All major components of your app must be listed here, including Activities, your custom Application class, Services, and BroadcastReceivers. For more, see Anatomy of an App.

What kind of things go in the res folder of your app?

Most things that are not explicitly code go into the res folder. This includes images in the form of drawables, XML layouts, strings, and menu resource files. For more, see Anatomy of an App.

What is a resource qualifier?

A resource qualifier is of the format “-<qualifier>” and goes on the end of a folder in res/. It tells the Android system what resources to use for specific configurations. For more info see Anatomy of an App.

What is the keyboard shortcut for invoking an action?

This is arguably the most important shortcut you should know: ⌘ Command + ⇧ Shift + A. For more useful shortcuts, see Handy Shortcuts.

What is an Activity?

You can think of an Activity as one screen on Android. Activities must be declared in the AndroidManifest.xml as they are a system component. They are usually associated with one xml layout.

What is the Activity lifecycle? What are some methods in the lifecycle?

The Activity lifecycle is a series of methods called by the framework to let you know what stage of life your Activity is in. You should only do certain work when your app is in certain stages of the lifecycle. Some lifecycle methods include onCreate, onDestroy, onResume, and onPause. For more info, see Activity Lifecycle.

How are logging statements made in Android? Where can you find the logs?

Android logging calls eventually end up in the Logcat. You can make logging statements through various methods, such as Log.d(TAG, message) and Log.wtf(TAG, message, exception). See LifecycleActivity's onCreate method for more info.

Describe the difference between a UI test and a Unit test. Which one should you have more of? Why?

A unit test is a small targeted test that exercises one minute piece of functionality. It typically lacks any references to the Android framework as it is just run on the JVM. As a result of not having dependencies on Android or physical devices, unit tests tend to run very quickly. This is in contrast to UI tests aka instrumentation tests. These tests tend to cover many pieces of functionality and also exercise the UI of your app. Because UI tests require an Android device to run, they are higher in fidelity (closer to what a user actually experiences), but are a lot slower than unit tests. You typically want to have 70% unit tests and 30% UI tests. See the testing lesson for more info.

What is the robot pattern?

Is it a good idea to hit your real web servers in tests?

Why would someone use Retrofit for networking vs just using OkHttp?

What is Android's main thread? How is it different from the UI thread? When shouldn't you use the main thread?

What is a configuration change? What happens to your Activity during one?

Describe the 3 parts of MVVM and what each part is used for.

What is dependency injection? What is it used for? What advantages does it provide?

How does Dagger help with dependency injection? Provide implementation details.

What is a memory leak? Name 2 ways to cause a memory leak and how to fix it.

You'd like to display many items in a list. How would you go about doing so? What classes do you need?

What are the two most important methods for creating a menu on Android?

What are some differences between a Fragment and an Activity?