Android Interview Questions and Answers

1) What language does Android support for application development? Ans: Android applications are written using the Java programming language.
2) Describe a real time scenario where android can be used? Ans: Imagine a situation that you are in a country where no one understands the language you speak and you cannot read or write. However, you have mobile phone with you. With a mobile phone with android, the Google translator translates the data of one language into another language by using XMPP to transmit data. You can type the message in English and select the language which is understood by the citizens of the country in order to reach the message to the citizens.
3) What are the advantages of Android? Ans: The following are the advantages of Android:
  1. The customer will be benefited from wide range of mobile applications to choose, since the monopoly of wireless carriers like AT&T and Orange will be broken by Google Android.
  2. Features like weather details, live RSS feeds, opening screen, and icon on the opening screen can be customized.
  3. Innovative products like the location-aware services, location of a nearby convenience store etc., are some of the additive facilities in Android.
  4. Components can be reused and replaced by the application framework.
  5. Optimized DVM for mobile devices.
  6. SQLite enables to store the data in a structured manner.
  7. Supports GSM telephone and Bluetooth, WiFi, 3G and EDGE technologies.
  8. The development is a combination of a device emulator, debugging tools, memory profiling and plug-in for Eclipse IDE.

4) Describe the APK format. Ans: The APK file is compressed the AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file.
5) What is an action? Ans: A description of something that an Intent sender desires.
6) What is activity? Ans: A single screen in an application, with supporting Java code.
7) What is intent? Ans: A class (Intent) describes what a caller desires to do. The caller sends this intent to Android’s intent resolver, which finds the most suitable activity for the intent. E.g. opening a PDF file is intent and the Adobe Reader is the suitable activity for this intent.
8) What is a resource? Ans: A user-supplied XML, bitmap, or other files, injected into the application build process, which can later be loaded from code.
9) What’s the difference between file, class and activity in android? Ans:  File – It is a block of arbitrary information, or resource for storing information. It can be of any type. Class – It is a compiled form of .Java file. Android finally used this .class files to produce an executable apk. Activity – An activity is the equivalent of a Frame/Window in GUI toolkits. It is not a file or a file type it is just a class that can be extended in Android for loading UI elements on view.
10) Can an application be started on power-up? Ans: Yes.
11) Does Android support the Bluetooth serial port profile?  Ans: Yes.
12) How will you record a phone call in Android? How to get a handle on Audio Stream for a call in Android? Ans: Permissions.PROCESS_OUTGOING_CALLS: Allows an application to monitor, modify, or abort outgoing calls.
13) What is a Sticky Intent? Ans: SendStickyBroadcast() performs a sendBroadcast (Intent) that is “sticky,” i.e. the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of registerReceiver (BroadcastReceiver, IntentFilter). In all other ways, this behaves the same as sendBroadcast(Intent). One example of a sticky broadcast sent via the operating system is ACTION_BATTERY_CHANGED. When you call registerReceiver() for that action — even with a null BroadcastReceiver — you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery.
14) How to select more than one option from list in android xml file? Give an example. Ans: Specify android id, layout height and width as depicted in the following example.
15) What is Android? Ans: Android is a stack of software for mobile devices which includes an Operating System, middleware and some key applications. The application executes within its own process and its own instance of Dalvik Virtual Machine. Many Virtual Machines run efficiently by a DVM device. DVM executes Java languages byte code which later transforms into .dex format files.
16) What is an Activity? Ans: A single screen in an application, with supporting Java code.
17) What is an Intent? Ans: A class (Intent) which describes what a caller desires to do. The caller will send this intent to Android’s intent resolver, which finds the most suitable activity for the intent. E.g. opening a PDF document is an intent, and the Adobe Reader apps will be the perfect activity for that intent (class).
18) How the nine-patch Image different from a regular bitmap? Alternatively, what is the difference between nine-patch Image vs regular Bitmap Image? Ans: It is one of a resizable bitmap resource which is being used as backgrounds or other images on the device. The Nine Patch class allows drawing a bitmap in nine sections. The four corners are unscaled; the middle of the image is scaled in both axes, the four edges are scaled into one axis.
19) What is a resource? Ans: A user defined JSON, XML, bitmap, or other file, injected into the application build process, which can later be loaded from code.
20) How will you record a phone call in Android? Or How to handle an Audio Stream for a call in Android? Ans: Permission.PROCESS_OUTGOING_CALLS: Will allow an application to monitor, modify, or abort outgoing calls. So using that permission we can monitor the Phone calls.
21) Does Android support the Bluetooth serial port profile? Ans: Yes.
22) Can an application be started on powerup? Ans: Yes.
23) What is the APK format? Ans: The APK file is compressed AndroidManifest.xml file with extension .apk. It also includes the application code (.dex files), resource files, and other files which are compressed into a single .apk file.
24) How to Translate in Android? Ans: The Google translator translates the data of one language into another language by using XMPP to transmit data. You can type the message in English and select the language which is understood by the citizens of the country in order to reach the message to the citizens.
25) Describe Briefly the Android Application Architecture Ans: Android Application Architecture has the following components:
  •  Services like Network Operation
Intent – To perform inter-communication between activities or services
  •  Resource Externalization – such as strings and graphics
Notification signaling users – light, sound, icon, notification, dialog etc.
  • Content Providers – They share data between applications

26) What is needed to make a multiple choice list with a custom view for each row? Ans: Multiple choice list can be viewed by making the CheckBox android: id value be “@android:id /text1″. That is the ID used by Android for the CheckedTextView in simple_list_item_multiple_choice.
27) What dialog boxes are supported in android?Android supports 4 dialog boxes: Ans:
  1.   AlertDialog: An alert dialog box supports 0 to 3 buttons and a list of selectable elements, including check boxes and radio buttons. Among the other dialog boxes, the most suggested dialog box is the alert dialog box.
  2.  ProgressDialog: This dialog box displays a progress wheel or a progress bar. It is an extension of AlertDialog and supports adding buttons.
  3. DatePickerDialog: This dialog box is used for selecting a date by the user.
  4. TimePickerDialog: This dialog box is used for selecting time by the user.

28) Why to use Android? Ans: Android is useful because: •    It is simple and powerful SDK •    Licensing, Distribution or Development fee is not required •    Easy to Import third party Java library •    Supporting platforms are – Linux, Mac Os, Windows
29) On which virtual machine Android runs? Ans: Dalvik virtual machine
30) What is the latest version in android? Ans: Android 4.2
31) Give the new Android platform for mobile phones? Ans: Android •    4.2 – jelly bean •    4.1- Ice-cream Sandwich •    3. X.X – Honeycomb •    2.3. X – Gingerbread •    2.2 – Froyo •     2.0/2.1 – Éclair •     1.6 – Donut •     1.5 – Cupcake
32) Give the languages that are supported by Android operating system for developing applications? Ans: It supports all the languages that are written using java code.
33) In what ways data can be stored in Android? Ans:  • Internal storage • Network connection • Shared preferences • SQLite database • External storage
34) What are user interface types? Ans: • Notifications • Views
35) Give notification types in Android? Ans: • Dialog notification • Status bar notification • Tost notification
36) What is a Sticky Intent? Ans: sendStickyBroadcast() performs as sendBroadcast (Intent) that is “sticky,” i.e. the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of registerReceiver (BroadcastReceiver, IntentFilter). In all other ways, this behaves the same as sendBroadcast (Intent). One example of a sticky broadcast sent via the operating system is ACTION_BATTERY_CHANGED. When you call registerReceiver() for that action — even with a null BroadcastReceiver — you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery.
37) What is the Android Open Source Project? Ans: We use the phrase “Android Open Source Project” or “AOSP” to refer to the people, the processes, and the source code that make up Android. The people oversee the project and develop the actual source code. The processes refer to the tools and procedures we use to manage the development of the software. The net result is the source code that you can use to build cell phone and other devices.
38) Why did we open the Android source code? Ans: Google started the Android project in response to our own experiences launching mobile apps. We wanted to make sure that there would always be an open platform available for carriers, OEMs, and developers to use to make their innovative ideas a reality. We also wanted to make sure that there was no central point of failure, so that no single industry player could restrict or control the innovations of any other. The single most important goal of the Android Open-Source Project (AOSP) is to make sure that the open-source Android software is implemented as widely and compatibly as possible, to everyone’s benefit. You can find more information on this topic at our Project Philosophy page.
39) What kind of open-source project is Android? Ans: Google oversees the development of the core Android open-source platform, and works to create robust developer and user communities. For the most part the Android source code is licensed under the permissive Apache Software License 2.0, rather than a “copyleft” license. The main reason for this is because our most important goal is widespread adoption of the software, and we believe that the ASL2.0 license best achieves that goal. You can find more information on this topic at our Project Philosophy and Licensing pages.
40) Why is Google in charge of Android? Ans: Launching a software platform is complex. Openness is vital to the long-term success of a platform, since openness is required to attract investment from developers and ensure a level playing field. However, the platform itself must also be a compelling product to end users. That’s why Google has committed the professional engineering resources necessary to ensure that Android is a fully competitive software platform. Google treats the Android project as a full-scale product development operation, and strikes the business deals necessary to make sure that great devices running Android actually make it to market.
41) By making sure that Android is a success with end users, we help ensure the vitality of Android as a platform, and as an open-source project. After all, who wants the source code to an unsuccessful product? Ans: Google’s goal is to ensure a successful ecosystem around Android, but no one is required to participate, of course. We opened the Android source code so anyone can modify and distribute the software to meet their own needs.
42) What is Google’s overall strategy for Android product development? Ans: We focus on releasing great devices into a competitive marketplace, and then incorporate the innovations and enhancements we made into the core platform, as the next version. In practice, this means that the Android engineering team typically focuses on a small number of “flagship” devices, and develops the next version of the Android software to support those product launches. These flagship devices absorb much of the product risk and blaze a trail for the broad OEM community, who follow up with many more devices that take advantage of the new features. In this way, we make sure that the Android platform evolves according to the actual needs of real-world devices.
43) How is the Android software developed? Ans: Each platform version of Android (such as 1.5, 1.6, and so on) has a corresponding branch in the open-source tree. At any given moment, the most recent such branch will be considered the “current stable” branch version. This current stable branch is the one that manufacturers port to their devices. This branch is kept suitable for release at all times. Simultaneously, there is also a “current experimental” branch, which is where speculative contributions, such as large next-generation features, are developed. Bug fixes and other contributions can be included in the current stable branch from the experimental branch as appropriate. Finally, Google works on the next version of the Android platform in tandem with developing a flagship device. This branch pulls in changes from the experimental and stable branches as appropriate. You can find more information on this topic at our Branches and Releases.
44) How Can we  write code for Android using C/C++? Ans: Yes, but need to use NDK Android applications are written using the Java programming language. Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language. Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included “dx” tool. Android only supports applications written using the Java programming language at this time.
45) What is the file features used in android? Ans: Android is rich in file features and it provides lots of variations in them as well. The file features are as follows: Intent filters: Includes bundle of information which describes a desired action. Icons and Labels: Includes information for small icon and a text label that can be displayed to users. These are set for an intent filter and are used to represent a component which fulfills the function advertised by the filter. Permissions: It is a restriction or limitation access to a part of code or data on the device. It is given as:-android.permission.CALL_EMERGENCY_NUMBERS Libraries: It includes the basic packages for building and developing applications
46) What is Android Runtime? Ans: Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language. Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included “dx” tool.
47) Describe of Android Market in compatibility? Ans: Devices that are Android compatible may seek to license the Android Market client software. This allows them to become part of the Android app ecosystem, by allowing users to download developers’ apps from a catalog shared by all compatible devices. This option isn’t available to devices that aren’t compatible.
48) What kinds of devices can be Android compatible? Ans: The Android software can be ported to a lot of different kinds of devices, including some on which third-party apps won’t run properly. The Android Compatibility Definition Document (CDD) spells out the specific device configurations that will be considered compatible. For example, though the Android source code could be ported to run on a phone that doesn’t have a camera, the CDD requires that in order to be compatible, all phones must have a camera. This allows developers to rely on a consistent set of capabilities when writing their apps. The CDD will evolve over time to reflect market realities. For instance, the 1.6 CDD only allows cell phones, but the 2.1 CDD allows devices to omit telephony hardware, allowing for non-phone devices such as tablet-style music players to be compatible. As we make these changes, we will also augment Android Market to allow developers to retain control over where their apps are available. To continue the telephony example, an app that manages SMS text messageswould not be useful on a media player, so Android Market allows the developer to restrict that app exclusively to phone devices.
49) If my device is compatible, does it automatically have access to Android Market and branding? Ans: Android Market is a service operated by Google. Achieving compatibility is a prerequisite for obtaining access to the Android Market software and branding. Device manufacturers should contact Google to obtain access to Android Market. Features of Android
  1. Application framework enabling reuse and replacement of components
  2. Dalvik virtual machine optimized for mobile devices
  3. Integrated browser based on the open source WebKit engine
  4. Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification (hardware acceleration optional)
  5. SQLite for structured data storage
  6. Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)
  7.  GSM Telephony (hardware dependent)
  8.  Bluetooth, EDGE, 3G, and WiFi (hardware dependent)
  9. Camera, GPS, compass, and accelerometer (hardware dependent)
  10. Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE.

50) How long does compatibility take? Ans: The process is automated. The Compatibility Test Suite generates a report that can be provided to Google to verify compatibility. Eventually we intend to provide self-service tools to upload these reports to a public database.
51) Who determines what will be part of the compatibility definition? Ans: Since Google is responsible for the overall direction of Android as a platform and product, Google maintains the Compatibility Definition Document for each release. We draft the CDD for a new Android version in consultation with a number of OEMs, who provide input on its contents.
52)  What is an action? Ans: A description of something that an Intent sender desires.
53) What is an activity? Ans: A single screen in an application, with supporting Java code. An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(View).
54) What is a service? Ans: A Service is an application component representing either an application’s desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use. Each service class must have a corresponding declaration in its package’s AndroidManifest.xml. Services can be started withContext.startService() and Context.bindService(). For Example, a service might play background music as the user attends to other matters, or it might fetch data over the network or calculate something and provide the result to activities that need it. Each service extends the Service base class.
55) What is AVD? Ans: An Android Virtual Device (AVD) is an emulator configuration that lets you model an actual device by defining hardware and software options to be emulated by the Android Emulator.
Naveen E

Naveen E

Author

Hola peeps! Meet an adventure maniac, seeking life in every moment, interacting and writing at Asha24.