Let us have a quick glance at a few of the important Android interview questions:
Q1. Explain the characteristics of Android. Q2. Why cannot you run the standard Java bytecode on Android? Q3. Can Android applications only be programmed in Java? Q4. Where will you declare your activity so the system can access it? Q5. What is a NinePatch (9-patch) image? Q6. What is the difference between an implicit intent and an explicit intent? Q7. Where can you define the icon for your activity? Q8. What is ADB? Q9. What are the different storage methods in Android? Q10. What is action in 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; build tools will care for the generation of DVM compatible files.
No, not necessarily. We can program Android apps using the Native Development Kit (NDK) in C/C++. The NDK is a toolset that allows us to implement parts of our app using native code languages such as C and C++. Typically, good use cases for NDK are CPU-intensive applications such as game engines, signal processing, and physics simulation.
Learn for free ! Subscribe to our youtube Channel.
Activity is to be declared in the manifest file. For example:
It is a resizable bitmap resource that can be used for backgrounds or other images on a device. NinePatch class permits drawing a bitmap in nine sections. The 9-patch images have an extension as .9.png. It allows extensions 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.
There are two types of intents: implicit intent and explicit intent. Let us see the differences between them.
Implicit intent: It is when we call system default intent like send e-mail, send SMS, or dial number.
Intent sendIntent = new Intent();
Explicit intent: It is when we call our own application activity. We can also pass the information from one activity to another using explicit intent.
For example, from the first activity to the second activity:
Intent intent = new Intent(first.this, second.class);
The icon for an activity is defined in the manifest file.
<activity android:icon="@drawable/app_icon" android:name=".MyTestActivity"></activity>
This means that we have to open AndroidManifest.xml. Right under the root ‘manifest’ node of the XML, we can see the ‘application’ node. We have added this attribute to ‘application’. (The ‘icon’ in ‘@drawable/icon’ refers to the file name of the icon.)
Get a detailed understanding of how to build Android game applications!
ADB stands for Android Debug Bridge. It is a command-line tool that is used to communicate with the emulator instance. ADB can control our device over USB from a computer, copy files back and forth, install and uninstall apps, run shell commands, and more. It is a client–server program that includes three components:
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.
In Android, an action is a description of something that an intent sender desires.
<action android:name="string" />
Description: It adds an action to an intent filter. An <intent-filter> element must contain one or more <action> elements. If it doesn’t contain any, no Intent objects will get through the filter.
Have you got more queries? Come to our Community and get them clarified today!
ANR is a short form for ‘Application Not Responding’. Android systems show this dialog if an application is performing too many tasks on the main thread and has been unresponsive for a long time.
• Entire lifetime: An activity that happens between onCreate and onDestroy • Visible lifetime: An activity that happens between onStart and onStop • Foreground lifetime: An activity that happens between onResume and onPause
Findviewbyid is a method that is used to find a view that is identified by the ID attribute from the XML processed inActivity.OnCreate(Bundle).
[Android.Runtime.Register("findViewById", "(I)Landroid/view/View;", "GetFindViewById_IHandler")]
public virtual View FindViewById (Int32 id)
Learn more about Android in this Android Course!
Drawable is the virtual resource that can be used as a background, title, or in other parts of the screen. It is compiled into an android.graphics.drawable subclass. A drawable resource is a general concept for a graphic that can be drawn. The simplest case is a graphical file (bitmap), which would be represented in Android via a BitmapDrawable class.
Drawable is stored as an individual file in one of the res/drawable folders. The ADT project creation wizard creates these folders by default. You would store bitmaps for different resolutions in the -mdpi, -hdpi, -xhdpi, and -xxhdpi subfolders of res/drawable. If these bitmaps are provided in a different folder, the Android system selects the correct one automatically based on the device configuration.
The applications must sign in with the same certificate in order to share the same Linux user ID and the VM.
No, the Android platform does not support JAR deployments. Applications are packed into Android Package (.apk) using Android Asset Packaging Tool (AAPT) and then deployed onto the Android platform. Google provides Android Development Tools for Eclipse that can be used to generate the Android Package.
It is not recommended to change the application name after its deployment because this action may break some functionality. For example, shortcuts will not work if you change the application name.
One technique that prevents the Android system from concluding a code that has been unresponsive for a long period of time is to create a child thread. Within the child thread, most of the actual tasks of the codes can be placed so that the main thread runs with minimal periods of unresponsive time.
Intents are created to define an action that we want to perform, and they launch the appropriate activity from another application.
Intent intent = new Intent(Intent.ACTION_SEND);intent.putExtra(Intent.EXTRA_EMAIL, recipientArray);
We can use bundles to pass data to sub-activities. There are HashMaps that take trivial data types. These bundles transport information from one activity to another.
Bundle b=new Bundle();
b.putString(“Email”, “[email protected]”);
i.putExtras(b); //where I is intent
Good Interview Questions.That helped me a lot to prepare for my Interviews.
Awesome Interview question and anwsers.This question help me for interview prepration.
Good interview questions . Helpful for me ,thanks
A highly informative write up. good job n more of that( info on android programming that is..)
This is the perfect site for anybody who really wants to understand this topic. You realize so uch its almost tough to argue with yoou (not that I really will need to?HaHa). You definitely put a fresh spin on a subject whidh has been discussed for a long time.
Excellent stuff, just great!
Your email address will not be published. Required fields are marked *