Can a user save all database updates in onStop ()?
Options
1) Yes, a user can save all database updates in onStop()
2) No, a user can save in onSavedInstance
3) No, a user can save in a Bundle
4) No, In some situations, a user can't reach onStop()
What is the importance of putExtra() method in Android? How is it different from setData()? Anyway both are passing data, then what is the difference?
Options
1) Both putExtra() and setData() are used for same purpose i.e. to pass data to other component.
2) setData() - is to pass data on which to take action. putExtra() - is to send extra information about this intent.
3) setData() - is to send extra information about this intent. putExtra() - is to pass data on which to take action.
4) Logically both are same, so one can omit setData(), and pass all data through putExtra only.
What are the various return values of onStartCommand(), and when to use what?
Options
1) START_STICKY - in case if android stops our service forcefully, then restart service by sending intent null
2) START_NOT_STICKY - in case if android stops our service forcefully, then don't restart, until user restarts it.
3) START_REDELIVER_INTENT- in case if android stops our service forcefully, then restart service by sending re-sending the intent.
4) all options are true
How to monitor service connection status in bound services?
Options
1) using isServiceConnected(), it returns true if service is connected
2) using onServiceDisConnected(), this function will be called if connection is broken
3) client can keep polling to service if it is available or not.
4) using ServiceConnection class.
Every application will have by default one thread. True or false?
Options
1) false, by default no threads available for a given application
2) True, always any given application will have default one main thread.
3) True, but it is not always, some times it may not have any thread.
4) both 2 and 3
Options
1) I can use a Fragment with out an Activity
2) A fragment can have multiple activities in it.
3) An activity can contain multiple fragments in it.
4) A fragment designed in one activity can't reused in other activity