-
Notifications
You must be signed in to change notification settings - Fork 1
Toasts
You can easily post toast messages with this library.
The class M holds various methods to post a toast message.
-
To Post a normal toast
-
eg:
M.T(context, "Hello World!");
M.T(context, message);context - context of the application.
message - message to be toasted(can be any object)
-
-
To Post a normal toast with length of the toast
-
eg:
M.T(context, "Hello World!", Toast.LENGTH_LONG);
M.T(context, message, length);context - context of the application.
message - message to be toasted(can be any object).
length - length of the toast can be (Toast.LENGTH_LONG or Toast.LENGTH_SHORT).
-
-
To Post a normal toast with different position
-
eg:
M.T(context, "Hello World!",Gravity.TOP | Gravity.START, 0, 0);
M.T(context, message, gravity, xPos, yPos);context - context of the application.
message - message to be toasted(can be any object).
gravity - the gravity of the toast.
xPos - The x-coordinate of the toast.
yPos - The y-coordinate of the toast.
-
-
To Post a normal toast with different position and length
-
eg:
M.T(context, "Hello World!", Gravity.TOP | Gravity.START, 0, 0, Toast.LENGTH_LONG);
M.T(context, message, gravity, xPos, yPos,length);context - context of the application.
message - message to be toasted(can be any object).
gravity - the gravity of the toast.
xPos - The x-coordinate of the toast.
yPos - The y-coordinate of the toast.
length - length of the toast can be (Toast.LENGTH_LONG or Toast.LENGTH_SHORT).
-
- To Post a custom view toast
-
eg:
M.T(view);M.T(view);view - view to be toasted.
- To Post a custom view toast with length of the toast
-
eg:
M.T(view, Toast.LENGTH_LONG);M.T(view, length);view - view - view to be toasted.
length - length of the toast can be (Toast.LENGTH_LONG or Toast.LENGTH_SHORT).
- To Post a custom view toast with different position
-
eg:
M.T(view, Gravity.TOP | Gravity.START, 0, 0);M.T(context, gravity, xPos, yPos);view - view to be toasted.
gravity - the gravity of the toast.
xPos - The x-coordinate of the toast.
yPos - The y-coordinate of the toast.
- To Post a custom view toast with different position and length
-
eg:
M.T(view, Gravity.TOP | Gravity.START, 0, 0, Toast.LENGTH_LONG);M.T(view, gravity, xPos, yPos, length);view - view to be toasted.
gravity - the gravity of the toast.
xPos - The x-coordinate of the toast.
yPos - The y-coordinate of the toast.
length - length of the toast can be (Toast.LENGTH_LONG or Toast.LENGTH_SHORT).
-
To Post a custom view(resource id) toast
-
eg:
M.T(context, R.layout.demo);
M.T(context, resID);context - context of the application.
resID - the id of the view to be posted.
-
-
To Post a custom view(resource id) toast with length of the toast
-
eg:
M.T(context, R.layout.demo, Toast.LENGTH_LONG);
M.T(context, resID, length);context - context of the application.
resID - the id of the view to be posted.
length - length of the toast can be (Toast.LENGTH_LONG or Toast.LENGTH_SHORT).
-
-
To Post a custom view(resource id) toast with different position
-
eg:
M.T(context, R.layout.demo, Gravity.TOP | Gravity.START, 0, 0);
M.T(context, resID, gravity, xPos, yPos);context - context of the application.
resID - the id of the view to be posted.
gravity - the gravity of the toast.
xPos - The x-coordinate of the toast.
yPos - The y-coordinate of the toast.
-
-
To Post a custom view(resource id) toast with different position and length
-
eg:
M.T(context, R.layout.demo, Gravity.TOP | Gravity.START, 0, 0, Toast.LENGTH_LONG);
M.T(context, resID, gravity, xPos, yPos, length);context - context of the application.
resID - the id of the view to be posted.
gravity - the gravity of the toast.
xPos - The x-coordinate of the toast.
yPos - The y-coordinate of the toast.
length - length of the toast can be (Toast.LENGTH_LONG or Toast.LENGTH_SHORT).
-