Monday, March 21, 2011

View, Intent, IntentFilters, Layout and Adapter etc.

1) What is View
Answer :-
This class represents the basic building block for user interface components. 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.).

2) What is Intent ? There are two types of Intent what are those and how they are different with each other ?
Answer:-
 An intent is an Intent object that holds the content of the message. The three components — activities, services, and broadcast receivers — are activated by asynchronous messages called intents. Intents can be divided into two groups: Explicit Intents and Implicit Intents.
  • Explicit Intents have specified a component (via setComponent(ComponentName) or setClass(Context, Class)), which provides the exact class to be run. Often these will not include any other information, simply being a way for an application to launch various internal activities it has as the user interacts with the application. 
  • Implicit Intents have not specified a component; instead, they must include enough information for the system to determine which of the available components is best to run for that intent 
3) What are IntentFilters ?
Answer :- A component's intent filters inform Android of the kinds of intents the component is able to handle or we can say that to inform the system which implicit intents they can handle. 


3) What are the different UI Layout ?
Answer :-
The standard Layouts are:
  • LinearLayout :- A Layout that arranges its children in a single column or a single row. The direction of the row can be set by calling setOrientation(). 
  • RelativeLayout :- A Layout where the positions of the children can be described in relation to each other or to the parent. 
  • TableLayout :- A layout that arranges its children into rows and columns. The rows are defined in the layout XML, and the columns are determined automatically by Android. 
  • FrameLayout :- FrameLayout is designed to display a single item at a time. You can have multiple elements within a FrameLayout but each element will be positioned based on the top left of the screen. 
  • AbsoluteLayout :- A layout that lets you specify exact locations (x/y coordinates) of its children. 
4) What is LayoutInflater in Android ?
Answer :-
 This class is used to instantiate layout XML file into its corresponding View objects. It is never be used directly -- use getLayoutInflater() or getSystemService(String) to retrieve a standard LayoutInflater instance that is already hooked up to the current context and correctly configured for the device you are running on.

5) What is Adapter in Android ?
Answer :-
 An Adapter object acts as a bridge between an AdapterView and the underlying data for that view. The Adapter provides access to the data items. The Adapter is also responsible for making a View for each item in the data set.

6) What is AdapterView ?
Answer :-
 An AdapterView is a view whose children are determined by an Adapter.

7) What is ContentValues and Cursor ?
Answer :-
ContentValues class is used to store a set of values that the ContentResolver can process.
             Cursor interface provides random read-write access to the result set returned by a database query

8) Content Provider is necessary for SQLite.
Answer :-
 No, Android provides a way for us to expose even our private data to other applications — with a content provider. A content provider is an optional component that exposes read/write access to your application data, subject to whatever restrictions you want to impose

9) How we draw a bitmap image ?
Bitmap imgBall=null;
BitmapDrawable b=(BitmapDrawable)getResources().getDrawable(R.drawable.ball);
imgBall=b.getBitmap();
canvas.drawBitmap(imgBall, xball, yball, paintObject); 
The Paint class holds the style and color information about how to draw geometries, text and bitmaps.

10)How we destroy/finish/kill/exit from application in Android ?
Answer :-
Call finish()

No comments:

Post a Comment