image
author

William Dawson

Full Stack Developer


Let us have a look at some important Android interview questions for beginners.

Android is the world’s most popular mobile platform. Initially developed by Android Inc., which Google bought in 2005, Android was unveiled in 2007. Moreover, the first commercial Android device was launched in September 2008. The core Android source code is known as Android Source Open Project (AOSP), which is primarily licensed under the Apache License.

In this article, will discuss some important Android interview questions for 2019.

Android interview questions in 2019.

Video Source The Verge
  • Improved app quality and discovery on Google Play.
  • Ability to capture audio from different apps in Android Q.
  • Internet of Things (IoT): Top features include safety, energy, connectivity, and sensing.
  • Android Jetpack: It is a set of tools, components, and guidance to build the best Android apps capable of running faster.
  • Android instant apps.
  • The Kotlin era.
  • Mobile wallets and payment gateways.
  • Beacons technology.
  • Motion and location sensing.

Importance of Android developers


As Android is the most popular operating system, it does have a few bugs. Someone should be able to fix bugs to ensure smooth user experience.

To achieve this, good Android developers are necessary. This is a field that may flourish in the future. And to hire good developers, asking the appropriate Android interview questions is important.

Q1. What are the seven lifecycle methods of Android activity and what is their purpose?


The seven lifecycle methods of Android activity are:

  • onCreate()
  • onStart()
  • onRestart()
  • onResume()
  • onPause()
  • onStop()
  • onDestroy()

Their purpose is to help structure your code around how you want an activity to perform throughout its lifecycle on the device.

For example, onCreate() is where you would perform your static setup, from creating views to binding data lists. It is always immediately followed by onStart(), where the app will be made visible to the users.

Q2. Briefly list the components of the Android architecture.


This is another top-level question to help you gauge how well the developer understands the big picture of application design. The Android software stack is typically divided into five main components:

  1. Linux kernel: The base layer of an application that directly interfaces with the device hardware – this is the level that deals with hardware drivers like the camera, keypad, and display.
  2. Native libraries: Resting on top of the Linux kernel is a set of open-source libraries, including the SQLite database, libc, and the WebKit browser engine.
  3. Android runtime: The Dalvik Virtual Machine is on the same level as the native libraries and allows every Android app to run its processes.
  4. Application framework: The next layer up provides higher-level services in the form of Java classes to applications on the device. The key services to know are the Activity Manager, Content Provider, Resource Manager, Notifications Manager, and the View System.
  5. Applications: The top layer is the Android app itself. This is the level where you can install applications, and the one developers are most familiar with.

Q3. What is DDMS?


DDMS is short for Dalvik Debug Monitor Server. It ships natively with Android and contains many useful debugging features including location data spoofing, port-forwarding, network traffic trafficking, incoming call/SMS spoofing, thread and heap information, screen capture, and the ability to simulate network speed, state, and latency.

Q4. How would you check for the presence of a Compass sensor on the system using the hasSystemFeature() method?


While it may be tempting to call this method on SensorManager or Sensor, as they both come as part of the Android Sensor Framework, neither of those classes provide the hasSystemFeature() method. These classes find a use for direct access and acquisition of raw sensor data. When it comes to evaluating a system’s capabilities, you can use the PackageManager class to retrieve information on application packages available on a given device. I have written a possible solution for this query:

PackageManager myCompass = getPackageManager();
If(!myCompass.hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS))
{
//This device lacks a compass, disable the compass feature.
}

Q5. What is ADB?


This is one of the important Android interview questions.

ADB simply stands for Android Debug Bridge. It presents developers with the power to perform remote shell commands. Its major work is to permit and direct communication towards and from the emulator port.

Q6. Describe activities.


Activities are what you refer to as the window to a user interface. Just as you create windows to display output or to ask for an input in the form of dialog boxes, activities play the same role. Though it may not always be in the form of a user interface.

Q7. What is the importance of XML-based layouts?


The use of an XML-based layout provides a consistent and somewhat standard means of setting the GUI definition format. In common practice, layout details are placed in XML files while other items are placed in source files.

Q8. What do you think are some disadvantages of Android?


Given that Android is an open-source platform and the fact that different Android operating systems have been released on different mobile devices, there’s no clear cut policy on how applications can adapt with various OS versions and upgrades. One app that runs on this particular version of Android OS may or may not run on another version. Another disadvantage is that since mobile devices such as phones and tabs come in different sizes and forms, it poses a challenge for developers to create apps that can adjust correctly to the right screen size and other varying specs and features.

Q9. What’s the difference between a file, a class, and an activity in Android?


File: It is a chunk of arbitrary information or resource for storing information.

Class: It is a compiled form of Java file. Android uses the .class files to produce an executable apk.

Activity: An activity is comparable to a Frame/Window in GUI toolkits. It is not a file or a file type. It is just a class that you can extend in Android for loading UI elements on view.

Q10. What is the Dalvik Virtual Machine?


Dalvik is the name of Android’s virtual machine. The Dalvik VM is an interpreter-only virtual machine that executes files in the Dalvik Executable (.dex) format, a format for effective storage and memory-mappable executions.

The virtual machine is register-based and can run classes compiled by Java language compiler that have been altered into its native format using the included ‘dx’ tool. The VM runs on top of Posix-compliant operating systems depending on it for performing threading and low-level memory management functionalities. The Dalvik core class library provides a familiar development base for those used to programming with Java Standard Edition. But is geared explicitly for the needs of a small mobile device.

If the candidate can answer this Android interview questions, he/she has sufficient knowledge on Android.

Q11. What are the exemptions in Android?


InflateException: When error conditions occur, this exception is thrown.

Surface.OutOfResourceException: When a surface is not created or resized, this exception is thrown.

SurfaceHolder.BadSurfaceTypeException: When invoked on a surface “SURFACE_TYPE_PUSH_BUFFERS”, this exception is thrown from lockCanvas() method.

WindowManager.BadTokenException: This exception is thrown at the time of trying to view an invalid WindowManager.LayoutParamstoken.

Q12. What is the Open Headset Alliance?


The OHA is a conglomerate of 84 technologies and mobile companies that have joined hands to fast-track innovation in mobile technology and at the same time, offer the end-users an improved, cost-effective, and richer mobile experience. Members of this alliance include Google, HTC, Sony, NVIDIA, Dell, Intel, Motorola, Samsung, and others. The OHA was started on 5th November 2007 by Google and 34 other companies. Android is the primary OS of this alliance.

Q13. If an application is crashing frequently, how will you troubleshoot it?


If an Android application is crashing frequently, you can do the following:

  • Free memory: As there is a limited amount of space on mobile devices, you can try by freeing up memory space for the application to function properly.
  • Compatibility check: It may not be a hardware problem, but more of a software issue. It is not always possible to test an application for all devices and the OS system. There might be a chance that the application is not compatible with the OS. Check the compatibility on the application’s Google Play Store page.
  • Memory management: Some applications run perfectly on one mobile device but may crash on other devices. This is where processing speed, memory management, and CPU speed comes into play. Check the application memory requirements if the application is constantly crashing.
  • App data usage: If an application is crashing frequently, you can delete the application’s data, which will clear its cache memory and allow some free space on your device and might boost the app’s performance.

Q14. What is the AndroidManifest.xml file and why do you need this?


This is one of the best Android interview questions.
The AndroidManifest.xml file contains information about the application, and it sends this information to the Android system. This data may include the package name, components such as activity, services, content providers, and more. This file executes the following tasks:

  • Providing a unique name to the Java package.
  • Describing various components of the application, such as activity, services, and more. It also defines the classes which will implement these components.
  • Declaring the Android API which will be used by the application.
  • It contains the library file details linked to the application.

Q15. Explain different launch modes in Android.


Below are the different Android launch modes:

  • Standard: This launch mode generates a new instance of the activity in the task from which it originated. It is possible to create multiple instances of the same activity, and you can add them to the same or different tasks.
  • SingleTop: This launch mode is similar to the Standard Launch Mode, except if there exists a previous instance of the activity on top of the stack, then it does not create a new instance. But the intent is sent to the existing instance of the activity.
  • SingleTask: This launch mode will always create a new task and push a new instance to the task as the root one.
  • SingleInstance: This launch mode is the same as the SingleTask launch mode but the system doesn’t launch any new activities in the same task. In a scenario where the new activity is launched, it is launched in a separate task.

Q16. Name the different data storage options available on the Android platform?

As you know, the Android platform provides a variety of data storage options which a user can use depending upon the need of the user. The storage options are:

  • SharedPreference: This option stores data in XML files.
  • SQLite: This stores structure data in the private database.
  • Internal storage: This stores data in the device file system where it cannot be read by other applications.
  • External storage: This stores data in the file system but all apps may access the device.

Q17. What is a ThreadPool? And is it more effective than using several separate threads?


ThreadPool consists of a task queue and a group of worker threads, which allows it to run multiple parallel instances of a task.

Here, you’re assessing the app developer’s understanding of how multithreading has the potential to improve the app’s performance, but it can also negatively impact performance when used incorrectly.

Using ThreadPool is more efficient than having multiple operations waiting to run on a single thread, but it also helps you avoid the considerable overhead of creating a destroying a thread every time you require a worker thread.

Q18. What is a BuildType in Gradle? And what can you use it for?


Build types define properties that Gradle uses when building and packaging your Android app.

These kinds of Android interview questions allow you to check that the developer can differentiate between product flavors, build variants, and build types, as these are very similar concepts that are a common source of confusion:

  • A build type defines how a module is built, for example, whether ProGuard is run.
  • A product flavor defines what is built, such as which resources are included in the build.
  • Gradle creates a build variant for every possible combination of your project’s product flavors and the build types.

Q19. What are the steps involved in creating a bound service through Android Interface Definition Language (AIDL)?

  • Define an AIDL interface in a .aidl file.
  • Save this file in the src/ directory of the application hosting the Activity and any other application that needs to bind to this service – the latter is particularly important, and is often overlooked.
  • Build your application. Android SDK Tools will then generate an IBinder interface file in your gen directory.
  • Implement this interface, by extending the generated Binder interface file in your gen directory.
  • Extend Service and overrideonBind()to return your implementation of the Stub class.

Q20. When might you use a FrameLayout?


Here, you’re looking for an understanding that you are expected to use the simplest layover that is possible. It is done to achieve what you want to achieve. FrameLayouts are designed to contain only a single item, making them an efficient choice when you need to display a single view.

If you add multiple views to a FrameLayout then it’ll stack them one above the other, so FrameLayouts are also useful if you need overlapping views, for example, if you’re implementing an overlay or a HUD element.

So Want to hire a developer?


I took some time off work and wrote this article, pitching out 20 essential Android interview questions, especially for beginners. I hope you liked and understood these questions and solutions well.

Do you need to complete a project within a prescribed budget and time?

Codersera is a global community of top developers, coders, mentors, PMs and CTOs. Generally, we undertake the development of a fully-fledged product. Starting from UI/UX designs to building wireframes, and scaling it up to enterprise-level apps. This is the best platform for startups that are not capable of hiring a full-time developer but want quality work.

Even more, a developer’s selection process for the platform is quite rigorous. Developers have five screening rounds. Only less than 1% make it to the end (imagine the difficulty). Afterward, Codersera inspects the developers for their expertise.

Consequently, any clients who have successfully got their projects done admire Codersera. Also, the clients are happy with their workers’ dedication and productivity. Applying online is quite easy to do. However, the developer rates are high due to the assured quality of work. If you are looking for a developer, click here.

How useful was this post?

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Please do Rate Us and Share!

Related Blogs

  • author
    Adam Davidson

    Best Android Emulator for PC

    Android emulator for PC or MACs is one of the best for gamers to focus and improve their gaming skills.There are many reasons for emulating Android on your Windows PC, because with the help of emulation it is much easier to test apps on-screen or desktop than a mobile device. Android developers can debug...

  • author
    Adam Davidson

    Companies that Use Node JS in Production

    Despite of being arrived late on the scene, NodeJS is dominating the entire application development scenario with its great optimal features. This is a well-kept secret for the seamless distribution of their services that some of the top companies that use NodeJS for its web-based applications today. From concurrence to being a lightweight runtime,...

  • author
    Lucas White

    How to Use callBack With setState in React

    Today we are going to explore the callback function in setState and get to know about how we can use it.  First of all, I’d like to explain the ‘callBack’ and ‘setState’. callBack functions is a function that is passed as an argument to another function, to be “called back” at a later time....

image

About The Author

William is a CTO and a full-stack engineer with 10 years of experience. He has spent the past seven years doing web and mobile apps. He’s good at designing architecture and implementing agile development process. The technologies he’s worked with include: Node.js, Elixir, Rails, AngularJS, React, React Native, Objective-C, iOS, Java, Android. He’s also familiar with C++, Haskell, C#/.NET. He is an enthusiastic programmer and a great guy to know

Try our One-Week Risk Free Trial for Hiring a Coder

Know more Hire a Coder