Android
AND-401 · Question #52
Consider the following code: Intent i = new Intent(this, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); What best explains the code above?
The correct answer is A. The activity being launched is already running in the current task, then instead of launching a new. See the full explanation below for the reasoning.
Question
Consider the following code: Intent i = new Intent(this, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); What best explains the code above?
Options
- AThe activity being launched is already running in the current task, then instead of launching a new
- BAny existing task that would be associated with the activity to be cleared before the activity is
- CA new Activity will be launched and it will be on the top of the stack
- DA new activity will be launched but will be in full-screen mode.
How the community answered
(48 responses)- A81% (39)
- B13% (6)
- C2% (1)
- D4% (2)
Community Discussion
No community discussion yet for this question.