android levin interview questions and answers paper 258 - skillgunNote: Paper virtual numbers may be different from actual paper numbers . In the page numbers section website displaying virtual numbers .
Which of the following format is not supported by android 1. mp3 2.avi
what is a class, file, and activity?
class is just like a java class where we write code. File can contain multiple classes. Activity is a screen in android with which user can interact. We write the code of an activity in java class.
draw life cycle of a fragment?
check this link http://developer.android.com/guide/components/activities.html
what is a widget?
Widget is a kind of dynamic shortcut for your application, where you can update the widget with content dynamically. The place where you put the widget (generally home application) is called as widget host. Eg: alarm clock, whether, cricket score widgets.
write android application development steps. (Including the architecture of the android)
It is a descriptive question. You have write how you create and run your application in eclipse. You have to show the pictorial representation of android architecture (4 layered architecture) . Top layer is application layer, second layer - framework layer, third layer - libraries & dvm, fourth and last layer is - kernel(o.s).
what is content provider?
Content Provider is the component of android that is used to share an application's data with out side world. Right now there is no support for shared preferences.
what is an intent receiver?
Broadcast Receiver (also know as intent receiver) - It is the component of android which gets triggered when systems sends some broadcast announcements. It is like a gateway for other components, can do small back ground functionality with in 10 seconds.
android system executes which file?
android works on which platform?
explain menus available in android?
There are 3 types of menus are there in Android. 1. OptionsMenu - triggered when user presses menu hard key. 2. SubMenu - Menu with in a menu (only one level of submenu is allowed). 3. ContextMenu - Triggered when user press and hold on some view which was registered to show context menu. Note: Options menu is deprecated, instead actions bar will be used.
explain about view and xml properties weight, gravity, padding, how to set the text and change the text for a button?
weight: Indicates how much of the extra space in the LinearLayout will be allocated to the view associated with these LayoutParams. You can use this property to tell how much portion of remaining space has to be used by your view.
gravity: gravity of the content with in the view. i.e whether content should be aligned center, right, bottom, or left.
padding: . Padding can be used to offset the content of the view by a specific amount of pixels. For instance, a left padding of 2 will push the view's content by 2 pixels to the right of the left edge.
To set text for button b, you can call b.setText("button");
which layout is fixed?
absolute layout is fixed layout.
Note: it is deprecated, and not suggestible to use as it is fixed size. Which may create compatibility issues.
what is a service?
Service is a component of android, which can be used to perform long running operations in the back ground with out having UI.
Eg: playing music is a service, because even if you close mp3 application still songs will be playing in the background. That is done by service.
how to add icons to a view, and where do you find icons?
To add icons or images to a view you can use xml property of the view android:background="@drawable/icon".
all icons are located in Res-> drawable folder.
Note: when you add image or icon to a view, there is a chance that it may not appear properly in all the phone sizes (resolutions). To have better effect us 9 patch image. Don't use normal images.
on clicking notification how to launch an activity?
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Intent in = new Intent(getApplicationContext(), SecondScreen.class);
PendingIntent pi = PendingIntent.getActivity(getApplicationContext(),
1, in, 0);
Notification n = new Notification(R.drawable.ic_launcher, "noti 1", System.currentTimeMillis());
n.setLatestEventInfo(getApplicationContext(), "plz read", "noti 1", pi);
n.flags |= Notification.FLAG_AUTO_CANCEL;
mention some android specific exceptions.
ActivityNotFoundException, ServiceNotFoundException, InflateException, WindowManager.BadTokenException, OutOfResourceException
mention some intent flags used in android?
Intent.FLAG_ACTIVITY_NEW_TASK, Intent.FLAG_ACTIVITY_CLEAR_TOP, Intent.FLAG_ACTIVITY_SINGLE_TOP, etc..
explain about types of dialogs available in android.
A dialog is a small window that prompts the user to make a decision or enter additional information.
Eg: when you are uploading some images to facebook, it will show a dialog with progress bar, telling how many images are done.
There are 4 types of dialogs available in android.
1. AlertDialog - in this 4 types - normal alert, items, single choice, & multi choice alert dialog.
4. Time picker dialog
what is the difference between normal image and 9-patch image. This you have to give lengthy description for your answer.
A NinePatchDrawable graphic is a stretchable bitmap image, which Android will automatically resize to accommodate the contents of the View in which you have placed it as the background. An example use of a NinePatch is the backgrounds used by standard Android buttons — buttons must stretch to accommodate strings of various lengths. A NinePatch drawable is a standard PNG image that includes an extra 1-pixel-wide border. It must be saved with the extension .9.png, and saved into the res/drawable/ directory of your project.
The border is used to define the stretchable and static areas of the image. You indicate a stretchable section by drawing one (or more) 1-pixel-wide black line(s) in the left and top part of the border (the other border pixels should be fully transparent or white). You can have as many stretchable sections as you want: their relative size stays the same, so the largest sections always remain the largest.
You can also define an optional drawable section of the image (effectively, the padding lines) by drawing a line on the right and bottom lines. If a View object sets the NinePatch as its background and then specifies the View's text, it will stretch itself so that all the text fits inside only the area designated by the right and bottom lines (if included). If the padding lines are not included, Android uses the left and top lines to define this drawable area.
To clarify the difference between the different lines, the left and top lines define which pixels of the image are allowed to be replicated in order to stretch the image. The bottom and right lines define the relative area within the image that the contents of the View are allowed to lie within.
what is an action bar.
Actionbar is replacement of options menu. This feature is added in 3.0 version.
In old android versions important menu items were displayed in options menu, which will be displayed only when user presses hardware menu button.
Action bar design is similar to how we display important menu items in a web site on top bar. Action bar will contain set of important action items on top bar of your application. Irrespective of which screen you are navigating to, android will display important action items on top bar which is always visible to user.
For more info please visit official android site: http://developer.android.com/guide/topics/ui/actionbar.html
Back To Top