Top 10 Toughest Android Interview Questions and Answers Guide 2018
The mobile phone market is surging with great speed. And the Android operating system has taken over the entire mobile domain with a bang. It has penetrated every nook and corner of the world. With the exponential growth in the usage of Android devices, the jobs opportunities in android app development are also gaining momentum. IT professionals with android app development skills are in great demand. Companies are on the lookout for skilled Android development professionals who have in-depth knowledge of Java, HTML and other technical tools. So if you are planning to make a career in this field, you will need to hone your technical skills and be well prepared to face the interviews. We have provided you with some basic Android interview questions and answers that are most commonly asked when you go for the job interview.
Here are some Android interview questions and answers for freshers who are looking to make a career in this uncharted arena of the Android world. Though these questions will give you a basic idea of how the companies conduct their interviews, it is advised that you enroll yourself in a good training institute that will help you gain the requisite knowledge and skill required to get any job in this area. Ace Web Academy is the top android training institute in Hyderabad that provides Android training courses. You can even enroll in android classes online and clear your fundamentals in Android programming. You will get an opportunity to start building apps and prepare yourself quickly for numerous Android jobs.
So let’s have a look at the Android interview questions and answers for freshers first.
1. Why can’t you run standard Java bytecode on Android?
Android does not use the traditional Java Virtual Machine. Instead, it uses Dalvik Virtual Machine that uses a special bytecode. That is why we cannot execute standard Java programs on an Android device. DVM is optimized for mobile devices. It optimizes the virtual machine for memory, performance and battery life. The applications that can run on Android are .apk files. It is a unique compiled code that stands for Android Package.
You can develop your code in Java. But you need to change the .jar files to .apk files before you can run your program in Android. The android tool called dx tool or the Dex compiler converts the Java class files into .dex files that can run on DVM. Android Assets Packaging Tool converts the .dex files in .apk files.
2. What is the difference between a regular .png and a nine-patch image?
A nine patch image is a stretchable bitmap image that can be used as a background of a view. Android automatically resizes the image to accommodate the content of the view. The nine patch image helps android in its goal to support a variety of different screen sizes. The main difference between a regular .png and nine patch image is that the latter includes an extra 1-pixel border around the image that determines where the image can be stretched to meet the specific layout constraints. The image can be divided into 9 sections. The 4 corners are static, the 4 edges are scaled in 1 axis and the center one can be scaled in both the axis. The extension of the nine patch images is .9.png.
Authors Suggestion: Top 5 Essential Skills that every Android Developer must have in 2018
3. There are four Java classes related to the use of sensors on the Android platform. List them and explain the purpose of each?
The sensor framework that forms a part of Android package includes the following Java Classes
1. Sensor- This class helps you create an instance of a specific sensor. It also provides methods that let you determine the capabilities of the sensor.
2. Sensor Manager- This class is used to create an instance of the sensor service. It provides methods for accessing and listing sensors, registering sensor event listeners.
3. Sensor Event-This Java class is used to create a sensor event object. It provides information regarding the sensor event including raw sensor data, type of sensor, accuracy of data, timestamp of event etc.
4. Sensor Event Listener- This interface is used to create callback methods that receive sensor event notification when sensor value changes or sensor accuracy changes.
4. What is difference between Serializable and Parcelable? Which is best approach in Android?
While developing applications we often need to transfer data from one activity to another. This data needs to be included into a corresponding intent object. Some additional actions are also required to make the data suitable for transfer. For doing that the object should be serializable or parseable. Serializable is a standard Java interface. It is a simple approach where you simply mark a class serializable by implementing the interface and Java automatically serializes it. Reflection is used during the process and a lot of additional objects are created. This leads to a lot of garbage collection and poor performance.
Parcelable interface is a part of Android SDK where you implement the serialization yourself. Reflection is not used during this process and no garbage is created. It is faster because it is optimized for usage on android development, and shows better results.
5. How do you supply construction arguments into a Fragment?
In order to communicate from host activity to fragment, construction arguments are passed via Bundle. Setarguments(Bundle) is used to supply construction arguments for a fragment. Getarguments() is used to retrieve the arguments supplied to setarguments(bundle).
People Also Read: How to Become an Android Developer?
6. What is ANR, and why does it happen?
ANR refers to ‘Application Not responding’. It is a dialog box that appears when the user is interacting with an activity but activity is on Resume() method. Basically, the application does not respond for more than 5 seconds. The user is given the option of either closing the app or waiting for it to finish running. We may face this when a heavy long running task starts in the main UI thread. In order to prevent this, we can avoid running activities that require complex computations on the main thread. We can run such tasks in the background using Async Task class.
If you are an experienced professional with 1 year, 2 year or 3 years of experience in working with Android, the interviewer may ask you some very technical questions to test your in-depth knowledge. Here are some Android interview questions and answers for experienced professionals looking for a job change. Organizations are ready to provide a huge pay package to skilled professionals. So if you are well prepared with these basic Android developer interview questions you are sure to land a high paying job.
7. How can two Android applications share same Linux user ID and share same VM?
If two android applications require sharing same Linux user ID and same VM, they must sign with the same certificate. Android assigns a unique user ID to each application. If this attribute is set to the same value for 2 applications they will share the same ID.
8. How would you check for the presence of a Compass sensor on the system using the hasSystemFeature() method?
The sensor framework that forms a part of Android package has Sensor and SensorManager classes. But these classes do not provide the hasSystemFeature() method. So they cannot be used for evaluating a system’s capabilities. The PackageManager class can in fact be used to find out information about the application packages available on a given device. One way of checking the presence of a Compass sensor on the system is
PackageManager myCompass = getPackageManger();
// This device lacks a compass, disable the compass feature
Authors Suggestion: How to build your own Android App -Step by Step Guide
9. Name some exceptions in android?
o Inflate Exception- This exception is thrown by an inflater on error conditions.
o Surface.OutOfResourceException – This Exception is thrown when a surface couldn’t be created or resized.
o SurfaceHolder.BadSurfaceTypeException– This exception is thrown from lockCanvas() when called on a Surface whose type is SURFACE_TYPE_PUSH_BUFFERS.
o WindowManager.BadTokenException – This Exception is thrown when trying to add view whose WindowManager.LayoutParams token is invalid.
10. Explain hybrid example in java.
Hybrid inheritance is a combination of single and multiple inheritance. Since Java doesn’t support multiple inheritances with classes, hybrid inheritance is also not possible with classes. Hybrid inheritance can be achieved in the same way as multiple inheritances, that is through interfaces. We cannot extend two classes at a time, but we can implement two interfaces at a time. We use interfaces to declare methods. An interface is then extended by two different sub interfaces. Then a class implements these two sub interfaces to attain hybrid inheritance.
Hybrid Inheritance in Java
Android developer interview questions are usually technical in nature. They are designed to test your knowledge and skills to the fullest. So make sure you have your basics clear. Prepare yourself for questions relating to Android architecture, development framework features, latest versions and upgrades in OS platform etc. You must also have an idea of the overall Android app development process from conception of the idea to the final result. The interviewer will also test your knowledge relating to the portfolio of work that you are carrying. And apart from the above Android interview questions and answers, you should also prepare for some general interview questions relating to your career goals and objectives. The interviewers want to make sure that you are really interested and committed to a career in Android.
If you wish to be ready for any kind of interview question that you are asked, it is best to enroll yourself in Android training course with one of the top android training institutes in Hyderabad like Ace Web Academy. It provides both classroom training as well as online courses to suit different needs. Here aspiring developers learn how to work in Android Studio based development environment. They get a chance to develop their own portfolio of project and live apps. This helps in showcasing your skills and capabilities when you go for the interview. A formal training course will definitely be a differentiating factor that will give you an edge over your competitors.
Once you complete a course with Ace Web Academy you will be prepared to face both basic as well as advanced interview questions. Ace Web Academy not only prepares you for a career in Android but also provides complete placement support, so that you land your dream job. Its services like resume review, interview preparation, and access to hiring partners will help you kick-start your journey in Android development.
by Mr. Shiva Kumar,CEO
I am Shiva Kumar an enthusiastic professional. Expertise in Web Designing, Web Development, and digital marketing & research. Writing, educating people is my hobby.