Top Android Interview Questions and Answers

  1. What are the different storage methods in Android?

Android offers several different options for data persistence. Shared Preferences — Store private primitive data in key-value pairs. This sometimes gets limited as it offers only key-value pairs. You cannot save your own java types. Internal Storage — Store private data on the device memory.

2.Which elements can occur only once and must be present?

Among the different elements, the and elements must be present and can occur only once. The rest are optional, and can occur as many times as needed.

3.Why cannot you run standard Java bytecode on Android?

Android uses Dalvik Virtual Machine (DVM) which requires a special bytecode. First of all, we have to convert Java class files into Dalvik Executable files using an Android tool called “dx”. In normal circumstances, developers will not be using this tool directly and build tools will care for the generation of DVM compatible files.

Click for more Android Interview Questions to Crack the Interview

4. What is the difference between a regular .png and a nine-patch image?

It is a resizable bitmap resource that can be used for backgrounds or other images on the device. NinePatch class permits drawing a bitmap in nine sections. The nine patch images have extension as.9.png. It allows extension in 9 ways, i.e. 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.

5. Enumerate three key loops when monitoring an activity?

• Entire lifetime — activity happens between onCreate and onDestroy
• Visible lifetime — activity happens between onStart and onStop
• Foreground lifetime — activity happens between onResume and onPause

6. Which dialog boxes can you use in your Android application?

  • AlertDialog : An alert dialogue box supports 0 to 3 buttons and a list of selectable elements.
  • ProgressDialog : An extension to AlertDialog and you may add buttons to it. It shows a progress wheel or a progress bar.
  • DatePickerDialog : It is used for selecting a date by the user.
  • TimePickerDialog : It is used for selecting time by the user.

Check the recent updates in Android