Questions and Answers in Android ?

Que 1: Describe the APK format. 
Ans:

  • Android application package file (APK) is the file format used to distribute and install application software and middleware onto the Google Android operating system. (Same as .exe in windows)
  • Each Android application is compiled and packaged in a single file that includes all of the application’s code (.dex files), resources, assets, and manifest file.
  •  The application package file can have any name but must use the .apk extension

Que 2: What is activity? 
Ans:

  • Activity is a single screen in application.
  • It is derived from Activity class and support JAVA code.
  • You can put view by using setContentView(View) method.
  • Most commonly, an activity is visibly represented by a full screen window that can receive and handle UI events and perform complex tasks. Though an Activity is typically full screen, it can also be floating or transparent.

Que 3: What is intent? 
Ans: 

  • An Intent object is an instance of Intent.
  • A message object that you can use to launch or communicate with other applications/activities asynchronously.
  •  It includes several criteria fields that you can supply, to determine what application/activity receives the Intent and what the receiver does when handling the Intent. Available criteria include include the desired action, a category, a data string, the MIME type of the data, a handling class, and others.

Que 4: What is an action? 
Ans:

  • A description of something that an Intent sender wants done.
  • An action is a string value assigned to an Intent.
  • Action strings can be defined by Android or by a third-party developer.
  • For example, android.intent.action.VIEW for a Web URL

Que 5: How is nine-patch image different from a regular bitmap? 
Ans:

  • It is a resizable bitmap resource that can be used for backgrounds or other images on the device.
  •  The NinePatch class permits drawing a bitmap in nine sections. The four corners are unscaled; the four edges are scaled in one axis, and the middle is scaled in both axes.
  • We can create 9-patch images by using Draw 9-patch tool.

Que 6: Explain Draw 9-patch tool.

Ans:
  • The Draw 9-patch tool allows you to easily create a Ninepatch graphic using a WYSIWYG editor.

Que 7: What is a resource ? 
Ans:

  • A user-supplied XML(Strings/Animations/Colors), bitmap, or other file, injected into the application build process, which can later be loaded from code.

Ques 8: What is the difference between Service and Thread? 
Ans: 

  • Service is like an Activity but has no interface. Probably if you want to fetch the weather for example you won’t create a blank activity for it, for this you will use a Service.
  • It is also known as Background Service because it performs tasks in background.
  • A Thread is a concurrent unit of execution. You need to know that you cannot update UI from a Thread. You need to use a Handler for this, but read further.

Ques 9: What is View ? 
Ans: 

  • A View occupies a rectangular area on the screen and is responsible for drawing and event handling.
  • View is the base class for widgets, , which are used to create interactive UI components (buttons, text fields, etc.).

Ques 10: What is ViewGroup ?

Ans:
  • A ViewGroup is a special view that can contain other views (called children.)
  • The view group is the base class for layouts and views containers.
  • This class also defines the class  ViewGroup.LayoutParams which serves as the base class for layouts parameters.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s