What does the flag FLAG_ACTIVITY_SINGLE_INSTANCE do here?
Intent i = new Intent();
i.setAction("com.android.MYACTION");
i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_INSTANCE);
startActivity(i);
Options
1) It will start a new activity with matching intent filter, in a new task always.
2) It will start a new activity with matching intent filter, in a new task only if that corresponding task is not in memory now.
3) It will start a new activity with matching intent filter, in old task always. here old task means task in which the current activity is running which has started new activity.
4) This will start new activity in a new task, where only this activity will be there in that task and no other components. if at all new components are launched from this new activity, they will be launched in a different task.
What does the flag FLAG_ACTIVITY_NEW_TASK do here?
Intent i = new Intent();
i.setAction("com.android.MYACTION");
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
Options
1) This will start a new activity in a new task, where only this activity will be there in that task and no other components. if at all new components are launched from this new activity, they will be launched in a different task.
2) It will start a new activity with matching intent filter, in old task always, here old task means task in which the current activity is running which has started new activity.
3) It will start a new activity with matching intent filter, in a new task only if that corresponding task is not in memory now.
4) It will start a new activity with matching intent filter, in a new task always.
Options
1) Activity manager is used to monitor and manage activity stack.
2) we can use activity manager to retrieve information about tasks that user has visited recently, information about currently running processes, information about particular task that is currently running, etc.
3) both options are true
4) none
What is the difference between intent, sticky intent, and pending intent?
Options
1) intent - is a message passing mechanism between components of android; Sticky Intent - Sticks with android, for future broad cast listeners; Pending Intent - Will be used when some one wants to fire an intent in future.
2) intent - is a message passing mechanism between components of android except for Content Provider; Sticky Intent - Sticks with android, for future broad cast listeners; Pending Intent - Will be used when some one wants to fire an intent in future.
3) intent - is a message passing mechanism between components of android except for content Provider;
Sticky Intent - Sticks with android, for future broad cast listeners; Pending Intent - Will be used when some one wants to fire an intent in future and may be at that time that app is not alive.
4) same as 3rd option, but sticky and pending intent are same.
What will happen if an activity is started with implicit intent, and there is no matching intent-filter?
Options
1) Nothing will happen, but it will not launch any new screen.
2) Nothing will happen, some how how it launches target component
3) It will throw run time exception - activityNotFoundException, and crashes if it is handled properly.
4) Compile time error.
What will happen if there is no action in an implicit intent, will it trigger any component?
Options
1) Will pass the action test if intent-filter has at least one action.
2) Will pass the action test if intent-filter also doesn't have any action.
3) Will pass the test if intent is explicit. In case of explicit intent it will test for intent resolution.
4) Will pass the action test only if intent has at least one action.
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.
Mathematics has 25%formulas, 25%proofs and apply 25%thinking and 25%efforts.
In real life situations proofs are nothing but already existed stories(we know the solutions from all experienced people).
formulas are nothing but goals. we have so many goals b