Select chapter



basics (6.papers)
activities (5.papers)
services (2.papers)
threads (2.papers)
receivers (1.papers)
advanced android (2.papers)
SQLite database (1.papers)
adapters (1.papers)
adb and ddms (1.papers)
widgets (1.papers)
fragments (1.papers)
UI (1.papers)
Hide

Sponsored Links


  

android interview questions and answers

Show Answer
Share Facebook gmail Twitter
2
What is broadcastreceiver in android?
  1. It is a component of android which responds to system wide broadcast announcments.
  2. It acts like a gateway between outside world and your application.
  3. both are true
  4. none
Show Answer
Share Facebook gmail Twitter
3
Broadcast receiver runs in which thread, by default?
  1. Main Thread
  2. background thread
  3. No thread
Show Answer
Share Facebook gmail Twitter
4
What will happen if broad cast receiver binds to binder service? Is there any problem?
  1. No, One should not bind a service from Broadcast receiver.
  2. Option 1 is right because, broadcast receivers will have a time limit of 10 seconds. establishing connection to a service may take more time.
  3. No problem will occur if one binds a service from broad cast receiver.
  4. Option 3 is right because, receivers doesn't have any time limit to finish its functionality.
Show Answer
Share Facebook gmail Twitter
5
Is it possible to start a service from a broadcast receiver?
  1. yes can start using startService() function
  2. No, never start a service from a broadcast receiver
Show Answer
Share Facebook gmail Twitter
6
What is the difference between broadcast receiver and a service?
  1. BroadcastReceiver - is like gateway for other components, can do small back ground functionality with in 10 seconds. Services - can do long running operation in the background with out having UI, and no time limit for it.
  2. Service - is like gateway for other components, can do small back ground functionality with in 10 seconds. BroadcastReceiver - can do long running operation in the background with out having UI, and no time limit for it.
  3. Option 1 is right, but a service can interact with UI if it wants. Its not mandatory that service should not have UI.
  4. Options 1 is right, but both receiver and service both can interact with UI if they want to. Broadcast Receivers have time limit of 10 seconds, and they respond to broadcasted messages.
Show Answer
Share Facebook gmail Twitter
7
How to start a broadcast receiver on phone boot completed?
  1. <receiver >
                <intent-filter >
                    <action android:name="android.intent.action.BOOT_COMPLETED"/>
                </intent-filter>
            </receiver>
  2. <receiver >
                <intent-filter >
                    <action android:name="intent.action.BOOT_COMPLETED"/>
                </intent-filter>
            </receiver>
  3. <receiver >
                    <action android:name="intent.action.BOOT_COMPLETED"/>
            </receiver>
  4. <broadcastreceiver >
                <intent-filter >
                    <action android:name="intent.action.BOOT_COMPLETED"/>
                </intent-filter>
            </broadcastreceiver>
Show Answer
Share Facebook gmail Twitter
Show Answer
Share Facebook gmail Twitter
9
What is the difference between sendbroadcast(), sendorderedbroadcast(), sendstickybroadcast() ?
  1. sendbroadcast() - normal broadcast
    sendorderedbroadcast() - we can set priority
    sendstickybroadcast() - intent passed with this will be stick for future users
  2. sendbroadcast() - normal broadcast, but we can set priority as well.
    sendorderedbroadcast() - we can set priority, and set result. can't block broadcasts.
    sendstickybroadcast() - intent passed with this will be stick for future users
  3. sendbroadcast() - normal broadcast, but we can set priority as well.
    sendorderedbroadcast() - we can set priority, and set result. can block broadcasts as well.
    sendstickybroadcast() - intent passed with this will be stick for future users
  4. sendbroadcast() - normal broadcast, but we can set priority as well.
    sendorderedbroadcast() - we can set priority, and set result. can block broadcasts.
    sendstickybroadcast() - intent passed with this will be available for only one time.
Show Answer
Share Facebook gmail Twitter
10
What is the life cycle of a broadcast receiver in android?
  1. onReceive()
  2. onCreate() -> onReceive()
  3. onCreate() -> onReceive() -> onDestroy()
  4. onReceive() -> onDestroy()
Show Answer
Share Facebook gmail Twitter
11
Under what thread broad cast receiver will run?
  1. Worker thread
  2. Kernel thread
  3. Main Thread
  4. No thread
Show Answer
Share Facebook gmail Twitter
12
To notify something to the user from a broadcast receiver, should I use dialogs or notifications? Why?
  1. Use Dialogs, because they are more visible than Notifications.
  2. Use Notifications, cause Receivers has to finish its functionality in 10 seconds
  3. Use notifications, because showing Dialog all of sudden may disturb user.
  4. Use both Dialogs and Notifications for safe side.
Show Answer
Share Facebook gmail Twitter
13
How to create a receiver without registering it in manifest file?
  1. Every component has to get registered in the manifest file.
  2. We can register receiver dynamically in code.
  3. we can register receiver statically in code.
  4. option 1 is true because, with out intent-filter test it is not possible to launch code.
Show Answer
Share Facebook gmail Twitter
14
How to send BATTERY_LOW broadcast? should I use sendbroadcast() or sendstickybroadcast? Why?
  1. Use sendBroadCast(), because for sticky you may need to take permission.
  2. use sendStickyBroadCast(), because logically this broadcast has to be available for future users.
  3. We can use either, no harm.
  4. use sendOrderedBroadcast(), because it has to be ordered properly.
Show Answer
Share Facebook gmail Twitter
15
How set an alarm to trigger after two days? how to implement it? assume that user may switch off the phone in between.
  1. Use AlarmManager and call set() to set after 2 days. Even phone switches off nothing will happen.
  2. Use AlarmManager and call set() to set after 2 days. If phone switched off, all alarms will be dead. So it is not possible.
  3. Option 2 is right, but it can be reset after switching on, before switching off maintain all alarms details in Data Base and recreate it after switching on.
  4. Option1 is true, because when phone got switched off all alarms will be dead, but when phone is switched on android will re created alarms automatically.
Show Answer
Share Facebook gmail Twitter
16
Trigger broadcast receiver only if my activity is in memory, else it should not get triggered, how to do it?
  1. Send broadcast only when your activity is alive.
  2. Register a dynamic receiver in that Activity.
  3. Register a static receiver in manifest file
  4. It is not possible to achieve
Show Answer
Share Facebook gmail Twitter
17
How to make a receiver which will get triggered immediately after booting.
  1. <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>    
    <receiver android:name="BroadcastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
    
            </intent-filter>
        </receiver>
  2. <receiver android:name="BroadcastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
    
            </intent-filter>
        </receiver>
  3. <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>    
    <receiver android:name="BroadcastReceiver">
            <intent-filter>
                <action android:name="Intent.BOOT_COMPLETED"></action>
    
            </intent-filter>
        </receiver>
  4. <receiver android:name="BroadcastReceiver">
            <intent-filter>
                <action android:name="Intent.BOOT_COMPLETED"></action>
    
            </intent-filter>
        </receiver>
Show Answer
Share Facebook gmail Twitter
Read more papers :