Android Notifications
Android Notifications
• A notification is a message that Android displays outside your app's UI to provide the user
with reminders, communication from other people, or other timely information from your
app. Users can tap the notification to open your app or take an action directly from the
notification.
• Notifications could be of various formats and designs depending upon the developer:
[Link] Bar Notification (appears in the same layout as the current time, battery percentage)
[Link] drawer Notification (appears in the drop-down menu)
[Link]-Up Notification (appears on the overlay screen, ex: Whatsapp notification, OTP
messages)
[Link]-Screen Notification
Android
Notifications
Template
Android Toast
• Andorid Toast can be used to display information for the short
period of time. A toast contains message to be displayed quickly and
disappears after sometime.
• The [Link] class is the subclass of [Link]
class.
• Toast class is used to show notification for a particular interval of
time. After sometime it disappears. It doesn't block the user
interaction.
Android Toast
• Methods of Toast class
Method Description
public static Toast makeText(Context
context, CharSequence text, int makes the toast containing text and duration.
duration)
public void show() displays toast.
public void setMargin (float changes the horizontal and vertical margin
horizontalMargin, float verticalMargin) difference.
Toast toast=[Link](getApplicationContext(),"HelloJavatpoint",Toast.LENGTH_SHORT);
[Link](50,50);
[Link]();
Android AlertDialog
• Android AlertDialog can be used to display the dialog
message with OK and Cancel buttons. It can be used to
interrupt and ask the user about his/her choice to
continue or discontinue.
• Android AlertDialog is composed of three regions: title,
content area and action buttons.
• Android AlertDialog is the subclass of Dialog class.
Method Description
public [Link] setTitle(CharSequence) This method is used to set the title of AlertDialog.
This method is used to set the message for
public [Link] setMessage(CharSequence)
AlertDialog.
public [Link] setIcon(int) This method is used to set the icon over AlertDialog.
Android SeekBar
• Android SeekBar is a kind of ProgressBar with
draggable thumb. The end user can drag the thum left
and right to move the progress of song, file download
etc.
• The [Link] interface
provides methods to perform even handling for seek
bar.
Android DatePicker
• Android DatePicker is a widget to select date.
It allows you to select date by day, month
and year. Like DatePicker, android also
provides TimePicker to select time.
• The [Link] is the subclass
of FrameLayout class.