Top 10 most important Interview question with Answer in android for fresher?


Hello Friends today i am going to share about top 10 interview question with answer.please read all question carefully that will help you to crack interview

Top 10 Interview Questions with Answer are follows:-


1.What is Activity and Activity Life Cycle

 Activity is an component and this is single screen for user interference.  
In Activity Lifecycle is controlled by 7 methods 

Activity methods are :-
1) onCreate - called when activity is first created.
2) onStart - called when activity is becoming visible to the user.
3) onResume - called when activity will start interacting with the user.
4) onPause - called when activity is not visible to the user.
5) onStop - called when activity is no longer visible to the user.
6) onRestart - called after your activity is stopped, prior to start.
7) onDestroy - called before the activity is destroyed.

For more details about Activity click here 


2.What are the basic key components of Android Architecture? 

There are 4 key components of Android  Architecture  :

- Linux Kernel
- Libraries
- Android Framework
- Android Applications

3. What is Intent and Intent filter?

3.1 Intent 

The Intent is the message that is passed between android components such as activities, content providers, broadcast receivers etc.
There are two type Intent in android.
1. Implicit Intent
2. Explicit Intent  

3.2 Intent filter

We know that Intent is used to call an another activity and  The android OS uses filters to pinpoint the set of  Services, Broadcast receivers and Activities that can handle the Intent with help of specified set of action, categories, data scheme associated with an Intent. we will use of  <intent-filter> element inside the manifest file and use of that we can categories and data types associated with any activity, service, or broadcast receiver.


4.What is DDMS in Android? 

DDMS means Dalvik Debug Monitor Server that ships with Android. 
It provides a wide array of debugging features Like : port-forwarding services, location data spoofing, screen capture, thread and heap information ,incoming call and SMS spoofing etc.

5.What is Service and Life Cycle? 

A service is runs on background without user interaction such as playing music, handle network transactions, interacting content providers etc..

LifeCycle of Service

Methods are service LifeCycle :

1. onStartCommand()

This method is called when the another component like an activity, requests that the service be started, by calling startService(). 
Note - Once this method executes, the service is started and can run in the background indefinitely. it is your responsibility to stop the service when its work is done, by calling stopSelf() or stopService() methods

onBind()
You need to override this method, only if you are defining your service as bounded service. This method is called, when another component wants to bind with the service by calling bindService(). In your implementation of this method, you must provide an interface that clients use to communicate with the service, by returning an IBinder. You must always implement this method, but if you don’t want to allow binding, then you should return null.
The system calls this method when another component wants to bind with the service by calling bindService(). If you implement this method, you must provide an interface that clients use to communicate with the service, by returning an IBinder object. You must always implement this method, but if you don't want to allow binding, then you should return null
2.onUnbind()

This method called when all clients have disconnected from a particular interface published by the service.
3. onRebind()

This method called when new clients have connected to the service, after it had previously been notified that all had disconnected in its onUnbind(Intent).
4. onCreate()

This method is called while the service is first created  using onStartCommand(). Here all the service initialization is done. This method is called only single time.  
5. onDestroy()

This method called when the service is not used for long tome and is being destroyed. This method are clean up any resources such as threads, registered listeners, receivers, etc.
steners, receivers, etc.

Friends this tutorial will help to you crash interview based on android development. Read all the questions carefully. If you have any query about this Content please comments me on comment box blow.

6. What is Fragment and Life Cycle?

Android Fragment is a part of  Activity for build dynamic User Interface.we can also know as Sub-Activity.we can use multiple fragment in a Activity.

Fragment Life Cycle

The following lifecycle for fragment blow - :

1) onAttach: when the fragment attaches to the activity
2) onCreate: when a new fragment instance initializes.
3) onCreateView: when a fragment creates its portion of the view hierarchy, 
4) onActivityCreated: when the fragment’s activity has finished its own onCreate event
onStart: when the fragment is visible; a fragment cannot start until its starts and often starts immediately after the activity does
5) onResume: when the fragment is visible and interactable; a fragment cannot resume until its activity resumes and often does so in quick succession after the activity

There’s more. These lifecycle events happen when you remove a fragment:

6) onPause: when the fragment is no longer interactable; 
7) onStop: when the fragment is no longer visible; it occurs either after the fragment is about to be removed or replaced or when the host activity stops
8) onDestroyView: when the view and related resources created in onCreateView is removed from the activity’s view hierarchy and destroyed

9) onDestroy: when the fragment does its final clean up
10) onDetach: when the fragment is detached from its host activity

7. what is Android AndroidManifest.xml ?

The AndroidManifest.xml is a XML ifile that contain information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc.  

8. What is ANR? and How can the ANR be prevented?

ANR means A for Application, N for NOT, R for Responding
If i talk about in brief an ANR will occur if you are running a process on the UI thread which takes a long time, usually around 5 seconds.

9.What is Broadcast Receiver?

The  broadcast receiver is a Android component which allows you to register for system or application events likelike sms message received , phone call received/pick/cut ,battery status changed, the Wifi came on etc.


10.Difference between a regular .png image and a nine-patch image? 

The  Nine-patch image allows resizing accroding to content that can be used as background or other image size requirements for the target device.The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.

Thanks

2 comments

Thanks for sharing this android interview questions with answers. It is really helpful for all.
Android Training Chennai | Best Android Training institute in Chennai

Reply

Excellent blog, really helpful to me. Keep up the good work and share more like this.
Java Training center in Chennai | Java Institute in Chennai

Reply