Challenge: Customizing the Toast

For this challenge, customize the toast to show at the top instead of the bottom of the screen. To change how the toast is displayed, use the Toast class’s setGravity function. Use Gravity.TOP for the gravity value. Refer to the developer documentation at​reference/​kotlin/​android/​widget/​Toast#setgravity for more details.

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.