Android
AND-401 · Question #102
What does the following line of code do? Toast toast = Toast.makeText(this,"Android ATC", Toast.LENGTH_LONG); toast.setGravity(Gravity.TOP|Gravity.RIGH, 0, 0);
The correct answer is B. The toast will appear on the top-right corner. See the full explanation below for the reasoning.
Question
What does the following line of code do? Toast toast = Toast.makeText(this,"Android ATC", Toast.LENGTH_LONG); toast.setGravity(Gravity.TOP|Gravity.RIGH, 0, 0);
Options
- AThe toast will have it UI components place on the top-right corner.
- BThe toast will appear on the top-right corner.
- CThe toast will show the text message on top-right corner of the toast box.
- DThe toast will appear at the center of the screen at position (0,0), but aligned to the top- right
How the community answered
(30 responses)- A17% (5)
- B70% (21)
- C7% (2)
- D7% (2)
Community Discussion
No community discussion yet for this question.