What is the life cycle of a content provider?
Options
1)A content provider's onCreate() funcation will be called every time if some client calls providers funcations using content resolver.
2) A content provider's onCreate() funcation will be called when first time if some client calls providers funcations using content resolver.
3) All the content providers will be created (onCreate()) after phone has booted first time
4) None
Trigger broadcast receiver only if my activity is in memory, else it should not get triggered, how to do it?
Options
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
What is the difference between broadcast receiver and a service?
Options
1) BroadReceiver - 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 background 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 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.
4) Option 1 is right, but a service can interact with UI if it wants. Its not mandatory that service should not have UI.
Options
1) It a component of android which responds to system wide broadcast announcements.
2) It acts like a gateway between outside world and your application.
3) both are true
4)none
Options
1) yes every thread by default will have looper
2) no only handler threads will have loopers
3) only handler threads will have loopers, but we can prepare normal threads looper also.
4) only main thread will have looper
How to avoid synchronization problems in threads?
Options
1) Use synchronized block
2) Use Synchronized methods
3) Use synchronized threads
4) both option 1 and 2 is right.
What is the difference between task, process, application, and thread?
Options
1) task, process, and application every thing is same, but thread is a part of process.
2) process and application are same. Task may contain 1 or more applications, thread is an internal part of a process created by OS.
3) process and task are same. application means program, thread is part of task.
4)process and thread are same. similarly application and thread are same.
What is the difference between thread and handler thread, in android?
Options
1) Thread will have looper and Message Queue. Default this looper will be prepared to handle incoming messages from other threads.
2) Handler thread will have looper and MessageQueue, but looper is prepared to handle incoming message.
3) Both are same. No difference, but HandlerThread is sub class of Thread class.
4) Both are same. No difference, But HandlerThread is super class of Thread class.