Sei sulla pagina 1di 12

1.What is android?

Android is a stack of software for mobile devices which has Operating System, middleware and some key applications. The application executes within its own process and its own instance of Dalvik Virtual Machine. Many Virtual Machines run efficiently by a DVM device. DVM executes Java languages byte code which later transforms into .dex format files. 2.What are the features of Android?

Components can be reused and replaced by the application framework. Optimized DVM for mobile devices SQLite enables to store the data in a structured manner. Supports GSM telephone and Bluetooth, WiFi, 3G and EDGE technologies The development is a combination of a device emulator, debugging tools, memory profiling and plug-in for Eclipse IDE.

3.Why to use Android? Android is useful because:


It is simple and powerful SDK Licensing, Distribution or Development fee is not required Easy to Import third party Java library Supporting platforms are Linux, Mac Os, Windows

4. Describe Android Application Architecture. Android Application Architecture has the following components:

Services like Network Operation Intent - To perform inter-communication between activities or services Resource Externalization - such as strings and graphics Notification signaling users - light, sound, icon, notification, dialog etc. Content Providers - They share data between applications

5. Describe a real time scenario where android can be used Imagine a situation that you are in a country where no one understands the language you speak and you can not read or write. However, you have mobile phone with you. With a mobile phone with android, the Google translator translates the data of one language into another language by using XMPP to transmit data. You can type the message in English and select the language which is understood by the citizens of the country in order to reach the message to the citizens. 6. What are the advantages of Android?

The following are the advantages of Android:

The customer will be benefited from wide range of mobile applications to choose, since the monopoly of wireless carriers like AT&T and Orange will be broken by Google Android. Features like weather details, live RSS feeds, opening screen, icon on the opening screen can be customized Innovative products like the location-aware services, location of a nearby convenience store etc., are some of the additive facilities in Android.

7. How to select more than one option from list in android xml file? Give an example.

Specify android id, layout height and width as depicted in the following example. <ListView android:id="@+id/ListView01" android:layout_height="wrap_content" android:layout_width="fill_parent"></ListView>

8. What is needed to make a multiple choice list with a custom view for each row?

Multiple choice list can be viewed by making the CheckBox android:id value be @android:id /text1". That is the ID used by Android for the CheckedTextView in simple_list_item_multiple_choice.

9 . What are the dialog boxes that are supported in android? Explain.

Android supports 4 dialog boxes: AlertDialog : An alert dialog box supports 0 to 3 buttons and a list of selectable elements, including check boxes and radio buttons. Among the other dialog boxes, the most suggested dialog box is the alert dialog box. ProgressDialog: This dialog box displays a progress wheel or a progress bar. It is an extension of AlertDialog and supports adding buttons. DatePickerDialog: This dialog box is used for selecting a date by the user. TimePickerDialog: This dialog box is used for selecting time by the user.

10. Explain about the exceptions of Android. The following are the exceptions that are supported by Android

InflateException : When an error conditions are occurred, this exception is thrown Surface.OutOfResourceException: When a surface is not created or resized, this exception is thrown SurfaceHolder.BadSurfaceTypeException: This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS WindowManager.BadTokenException: This exception is thrown at the time of trying to add view an invalid WindowManager.LayoutParamstoken.

11. What are the multimedia features involved in making Android popular?

There is the demand for the rich multimedia that involves many features that are used till now to make the Android market more popular in all the phases. The application includes the following: Mixable audio effects developer can easily create audio environments using the API key that is provided with it like creating equalization, bass boost, headphone feature, etc. The android provide the tools that can be used to mix the audio effects and apply it. There is also support for new media formats like VP8 open video compression format that uses a container format that can run on all the platforms and add the support for AAC and AMR encoding. The applications provided allow higher quality video to be captured. The application allows the access to multiple cameras that allows the use of APIs to include the camera and its properties in one. The platform provides the application to include the camera with high and low resolution.
12. What are the different forms of communication provided by the Android applications?

There are different forms of communication that is used by the Android application developers like: Internet telephony: this is used to add SIP-based features to the application. This includes the full SIP protocol stack and includes integrated call management services. These services allow setting the ongoing and incoming voice calls without managing the sessions at the transport level. This provides the communication to be successful by determining the associated carriers. NFC (Near field communications) - this is used to allow the communication to happen between the developers that create the new class of application. These new applications are created and provided as a service to the users, organizations, merchants and advertisers. It allows the tagging of application that interests the user. The tag allows the user to communicate through wireless telephony services and allow the use of device hardware.
13. What are the services that can be allowed to run in a single process?

Android allows all the services and applications to run on a single process. This behavior is the default behavior that can be changed by using the different settings and

functions. The process can be declared by using android: process attribute. This places the component explicitly on the process. Service is not a separate process and itself its a process if not defined separately. The service is not used as a thread as well but it defines other threads in the program to do the work and create the application. The application runs and finds the errors in the program and the service just takes the necessary actions on them. The service also responds to the errors whenever necessary.
14. What are the steps that are required in Service Lifecycle?

The services allow the proper functioning of the system. The service starts with Context.startService() function and the system will retrieve the service using onCreate() method. To start the service it calls on onStartCommand(Intent, int, int)method with proper arguments that are given by the client. If the service is running and due to some problem the user doesn't want to run it then it uses Context.stopService()or stopSelf() method to properly implement the service for the user. Due to multiple calls of the Context.startService() method the program doesn't do any nesting of the program and shows the stopping of the services. Services can use the command stopSelf(int)method to stop their own service. A service doesn't stop untill all the processes are processed.
15. What are the different modes of operations used in services for Android?

There are two modes of operations that are necessary to run depending on the value returned by the startcommand(). The modes are as follows: START_STICKY: this mode is used for the services that are explicitly started and stopped according to the need and the requirement of the user. START_NOT_STICKY or START_REDELIEVER_INTENT: this service mode is used for services that are running only when the processing command sent to them. That means these run on the basis of the command that is passed to them by giving the instruction of execution. Clients uses the Context.bindService() that is used to get the persistent connection for a service. To create a service that is not already running the command onCreate is used.

16. What is the main reason of using process lifecycle in Android?

The android system will keep all the process that are hosting the services together at one place till the time the service is not started or connected to the client. The priority of the process is divided when running low on memory or when the process has to be killed. The process lifecycle is as follows: The service is running currently then the methods onCreate(), onStartCommand(), and onDestroy()methods, will run in the foreground to execute the process without being killed. The service is already started then the process can be considered as less important then the processes that are currently visible and used. This is done as there are only few processes that are visible to the users on the screen. The clients are bounded to the services they are providing requires more priority in the execution list. The service that is started uses startForeground(int, Notification)API to allow all the services to run in the foreground state. The system considers only the services where the user is still active as the services not to be killed.
17. How all the activities that are running run in main thread?

All the applications that are running or can be accessed runs in main thread of user interface by default. The modification can be done to make it run differently or to make it run or not at all. The exception also comes defining that the code handles the IPC calls that are coming from other processes. The system used to maintain separate pools for all the processes and threads. One pool consists of the transaction threads that are in each process to dispatch all the incoming calls. It also allows the interpersonal calls to be handled in a specialized manner. This allows the creation of separate threads that is used for long-running code, and to avoid blocking of the main user interface threads. The services that run can be killed by the system if it is going out of memory. The system restart the service and implement onStartCommand() to bring the activities back in the memory pool?
18. What are the different data types used by Android?

The data can be passed between many services and activities using the following data types: Primitive Data Types: are used to share the activities and services of an application by using the command as Intent.putExtras(). This primitive data passes the command to show the persistent data using the storage mechanism. These are inbuilt data types that are used with the program. They provide simple implementation of the type and easy to use commands.

Non-Persistent Objects: are used to share complex and non-persistent objects. These are user-defined data types that are used for short duration and are also recommended to be used. These types of objects allow the data to be unique but it creates a complex system and increase the delay.
19. What are the different approaches that are required to share the objects?

There are several types of approaches that are required to share the objects and all of them are listed below: Singleton class: is used for the application components that run in the same process. This allows the design to run only one instance at a time. It includes static methods with a name like getInstance(). This method returns the instance whenever it is called for the first time. This method also creates a global instance so that it can be called easily without using more memory in creation and destroying of the process. A public static field or method: is used as an alternate method to make the data accessible across Activities and Services that is to be used by the public. This defines the static fields or methods that are used by other classes in the application. The method is used to share an object that gets created by the static field pointing to an object and other accessible fields. A HashMap of WeakReferences to Objects: provide some long keys that map the activities that is called by an object from another object. This after mapping sends a key that is unique and long to show the truthfulness of the object.
20. What are the approaches required to share persistent userdefined objects?

Persistent objects come when there is process that is in the running state and the system can perform any action like restart or kill. If there is any data that will persist and required from another data then it is very essential to save it and share it so that if one activity is down, another activity can be performed without any hindrance. To share the complex persistent user-defined objects, it is required to have the approaches like: Application preferences: that is used to allow the user to change the setting of preferences and make it accessible by some other objects. Files: permissions on the files can be set so that any other file can also use and share the objects Content providers: allow easy to follow patterns that allow the user to select the object and share it with other functions.

Database: the database can be used to store the user data and can easily link between the user and the entity that are present in it.
21. What is the procedure to check status of an activity in Android?

The status of an activity can be start and stop only. The start means the activity is up and running. It is in execution state and performing some actions. Whereas the stop state defines that the activity is being stopped and performing no action on the system. To see or check the status of an activity there is a command that has to be used like NEW_TASK_LAUNCH flag that keeps the track of all the activities that are running and the main command under which the flag resides is given as startActivity() call. To bring the activity stack in front of the process that is already running require the command mentioned above to be used. The activity can be started remotely by using the remote services. These services allow easy interaction with the client and provide the sample to show it on the local server.
22. Write a program to show the addition and removing of the package.

The package is a collection of similar or different classes that can be added or removed. The package that is added with the following parameter in the command as PACKAGE_ADDED action this allow to broadcast the message of addition to the entire system and in the same way the remove command action i.e. PACKAGE_REMOVED is used. The program that performs both the action is as follows: <receiver android:name ="com.android.samples.app.PackageReceiver"> <intent-filter> <action android:name="android.intent.action.PACKAGE_ADDED"/> <action android:name="android.intent.action.PACKAGE_REMOVED"/> <data android:scheme="package" /> </intent-filter> </receiver>
23. What are the security measures that are taken to make Android secure?

Android uses many security measures to keep them away from the hackers. They have designed by making changes to the devices or installing a software service on the mobile. Android application uses sandbox that is very popular and allow limited access to the information that is very private and sensitive for the user. It allows the

permissions to be set for the use of the information. The security measures that are provided by android is the use of the encryption of the messages that allow user to remain without worry about there phone security. They also consists of user terms and agreements that also taken care of. Most of the time android doesn't allow other applications to run on their system but it can be done by using different resources that are available on-line. As, android is open source it is not fully secure but lots of security issues are being solved for make it more popular and bug free.
24. Which are the different tags that are required to create reusable user interface that include the layout?

Android offers wide range of user interface widgets through which the reusable user interface can be made. It requires some buttons to be made and also allow multiple widgets to be combined using the single and reusable component. There are XML layout files that are used in which each tag can be mapped to the class instance. The tags that are used are: <requestFocus />: this allows the component to remain in focus. <merge />: merge the components and their properties into one to create a reusable component code <include />: this includes the library files and visual components of XML. This also uses <merge /> tag that can be combined with it to create the merging layout. To create the layout these are the tags that are required and essential. The XML visual components are also used to define the overall structure of the layout.
25. Write a program that shows the creation of reusable user interface that includes the layout.

The program that uses the reusable user interface including the layout is given below: <com.android.launcher.Workspace android:id="@+id/workspace" android:layout_width="fill_parent" android:layout_height="fill_parent" launcher:defaultScreen="1"> <include android:id="@+id/cell1" layout="@layout/work" /> <include android:id="@+id/cell2" layout="@layout/work" /> </com.android.launcher.Workspace> The tag that is used in this are: <include />: this is the element tag and it includes other XML layout files. It calls the layout files by using their name and including @layout. This @ defines the inclusion of layout file in the program. The same out in the example is included two times. The

tag overrides some attributes that are included in the layout. The id can be added that uniquely identifies the application and the components that are used inside it.
26. What are the methods to avoid memory leaks in Android?

Android applications are well bundled with the memory but they have a drawback of running lots of application that keeps in the memory to make the processing faster. The more application in the memory, the faster will be the switch between the applications. The memory leaks can be avoided by changing the context. The context is used for many operations but it is used to access the resources on android. The widgets have a context parameter in their constructors. There are mainly two types of context: either activity or application. The program is as follows: @Override protected void onCreate(Bundle state) { super.onCreate(state); TextView label = new TextView(this); label.setText("Test memory leak"); setContentView(label); } if the context is having leaks in it then the activity then there is a possibility of the leaks of memory. The leaking of the entire activity can be checked. The system will automatically create and destroy one of the activities by default. Android will reload the application by using the rotation policy. And it will keep the entire static field maintained.
27. What are the steps required to avoid context related memory leaks?

The steps that are required to check and avoid the context-related memory leaks are as follows: Never keep the long-lived references linked with the context-activity. This reference can be of the same life as the activity or can be of different length that depends on the type of activity that is getting performed on the action. Use of context-application is much better than the context-activity as it allows the application to be reused again and again and the activity can be viewed or executed only once. The application takes less time to execute and activity can take more due to consisting of more than one application in it. Non-static inner classes should be avoided while getting used in the activity, as it doesn't control the life-cycle of the static-inner class and make some weak reference to the activities that are inside the process and getting used. There should not be relying upon the garbage collector as it is not the ultimate solution for the memory leaks that are defined.

28. What are the steps required in setting up the linkify calls intent?

Linkify is used to route the intent in an activity. This linkify allows the calls to be invoked and allow an activity to be handled. The process of executing the linkfy is as follows: linkfy is used to invoke the process in the TextView and allow the matching of the patterns to be turned into the intent links. Linkify monitors the intent links that is being selected by the user and allow it to be modified for further actions. Linkfy allows the user to select the link and when user selects it, it calls the VIEW action on the content that uses an URI that is associated with the link. Android takes the content that is represented by the URI and the data that is used. It looks for the ContentProvider component that is registered with the system and matches the URI of the content that is getting produced. If the match is found for the query done by android then the URI gets used by the ContentProvider and MIME type of data can be returned for the URI. Android uses the activity registered in the system that uses the intent-filter matching both the VIEW action and the MIME type for the data that can be linked with the URI.
29. What is an Activity? A single screen in an application, with supporting Java code. 30. What is an Intent? A class (Intent) which describes what a caller desires to do. The caller will send this intent to Android's intent resolver, which finds the most suitable activity for the intent. E.g. opening a PDF document is an intent, and the Adobe Reader apps will be the perfect activity for that intent (class). 31. What is a Sticky Intent? sendStickyBroadcast() performs a sendBroadcast(Intent) known as sticky, i.e. the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of registerReceiver(BroadcastReceiver, IntentFilter). In all other ways, this behaves the same as sendBroadcast(Intent). One example of a sticky broadcast sent via the operating system is ACTION_BATTERY_CHANGED. When you call registerReceiver() for that action -- even with a null BroadcastReceiver -- you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery. 32. How the nine-patch Image different from a regular bitmap? Alternatively, what is the difference between nine-patch Image vs regular Bitmap Image? It is one of a resizable bitmap resource which is being used as backgrounds or other images on the device. The NinePatch class allows drawing a bitmap in nine sections. The four corners are

unscaled; the middle of the image is scaled in both axes, the four edges are scaled into one axis. 33. What is a resource? A user defined JSON, XML, bitmap, or other file, injected into the application build process, which can later be loaded from code. 34. How will you record a phone call in Android? or How to handle an Audio Stream for a call in Android? Permission.PROCESS_OUTGOING_CALLS: Will Allow an application to monitor, modify, or abort outgoing calls. So using that permission we can monitor the Phone calls. 35. Does Android support the Bluetooth serial port profile? Yes. 36. Can an application be started on powerup? Yes. 37. What is the APK format? The APK file is compressed AndroidManifest.xml file with extension .apk. It also includes the application code (.dex files), resource files, and other files which are compressed into a single .apk file. 38. How to Translate in Android? The Google translator translates the data of one language into another language by using XMPP to transmit data. You can type the message in English and select the language which is understood by the citizens of the country in order to reach the message to the citizens. 39. Describe Briefly the Android Application Architecture Android Application Architecture has the following components: Services like Network Operation Intent - To perform inter-communication between activities or services Resource Externalization - such as strings and graphics Notification signaling users - light, sound, icon, notification, dialog etc. Content Providers - They share data between applications 40. What is needed to make a multiple choice list with a custom view for each row? Multiple choice list can be viewed by making the CheckBox android:id value be @android:id /text1". That is the ID used by Android for the CheckedTextView in simple_list_item_multiple_choice. 41. What dialog boxes are supported in android?Android supports 4 dialog boxes: AlertDialog: An alert dialog box supports 0 to 3 buttons and a list of selectable elements, including check boxes and radio buttons. Among the other dialog boxes, the most suggested dialog box is the alert dialog box.

ProgressDialog: This dialog box displays a progress wheel or a progress bar. It is an extension of AlertDialog and supports adding buttons. DatePickerDialog: This dialog box is used for selecting a date by the user. TimePickerDialog: This dialog box is used for selecting time by the user.

42. General Android questions The Activity life cycle is must. Different phases of Activity Life cycle. For example: when and how the activity comes to foreground? Knowledge on AndroidManifest file, For example: Why do we need this file, What is the role of this file in Android app development. Different Kinds of Intents Different Kinds of Context Different Storage Methods in android Kinds of Log debugger and Debugger Configuration How to debug the application on real device. How do you ensure that the app design will be consistent across the different screen resolutions Thread concepts also plus points as we deal with the treads more. Can you able to build custom views and how? How to create flexible layouts, For example to place English, Chinese fonts. What is localization and how to achieve? What are 9-patch images How to avoid ANR status How to do Memory management Inter Process Communication (IPC) What is onCreate(Bundle savedInstanceState), Have you used savedInstanceState when and why? Fragments in an Activity When to use a service How to use a broadcast receiver and register it both in the manifest and in code Intent filters The types of flags to run an application How to do data intensive calculations using threads Passing large objects (that can't be passed via intents and shouldn't be serialized) via a service Binding to a service and the service lifecycle How to persist data (both savedInstanceState and more permanent ways) Read more: http://www.javacodegeeks.com/2011/08/android-interview-questionsanswers.html#ixzz1q8JfUYXP

Potrebbero piacerti anche