Android Interview Questions and Answers Set 7

61.What is the benefit of an Android library project?

An Android library project allows the distribution of resources (e.g. layouts, themes) and manifest entries as well as Java Code (e.g. activites). It makes the process of creating multiple apps from the same code base easier.

62.What are typical subdirectories that the “res” directory does contain?

The “res” folder contains various resource files:

  • res/drawable/* -> images and nine-patch files.
  • res/layout/ -> XML-based UI layout files.
  • res/values/ -> strings, colors, dimensions, …
  • res/menu/ -> menu specification files
  • res/raw/ -> raw files like a CSV file, movie clip or audio clip (mp3)
  • res/xml/ -> general XML files

63.What is the function of an intent filter?

Because every component needs to indicate which intents they can respond to, intent filters are used to filter out intents that these components are willing to receive. One or more intent filters are possible, depending on the services and activities that is going to make use of it.

64.What is a StateListDrawable?

A StateListDrawable is a drawable object defined in the XML that allows us to show a different color/background for a view for different states. Essentially it’s used for Buttons to show a different look for each state(pressed,focused, selected, none).

65.How does RecyclerView differ from ListView?

  • A RecyclerView recycles and reuses cells when scrolling. This is a default behaviour. It’s possible to implement the same in a ListView too but we need to implement a ViewHolder there
  • A RecyclerView decouples list from its container so we can put list items easily at run time in the different containers (linearLayout, gridLayout) by setting LayoutManager
  • Animations of RecyclerView items are decoupled and delegated to ItemAnimator

ANDROID APPLICATION TRAINING
Weekend / Weekday Batch

66.What is the proper way of setting up an Android-powered device for app development?

The following are steps to be followed prior to actual application development in an Android-powered device:

-Declare your application as “debuggable” in your Android Manifest.

-Turn on “USB Debugging” on your device.

-Set up your system to detect your device.

67.How do you find any view element into your program?

Findviewbyid : Finds a view that was identified by the id attribute from the XML processed inActivity.OnCreate(Bundle).

Syntax

[Android.Runtime.Register(“findViewById”, “(I)Landroid/view/View;”, “GetFindViewById_IHandler”)]

public virtual View FindViewById (Int32 id)

68.How would you create an AUTOINCREMENT field?

For autoincrement, you have to declare a column of the table to be INTEGER PRIMARY KEY, then whenever you insert a NULL into that column of the table, the NULL is automatically converted into an integer which is one greater than the largest value of that column over all other rows in the table, or 1 if the table is empty.

69.What are the basic tools used to develop an android app?

  • JDK
  • Eclipse+ADT plugin
  • SDK Tools

70.What is sleep mode in Android?

In sleep mode, CPU is slept and doesn’t accept any commands from android device except Radio interface layer and alarm.