List of utility methods to do Toast Create
String | formatToastDist(String message, int value, String unit) format Toast Dist if (unit.equals("km")) message += ": " + value + " km"; else message += ": " + KmToMiles(value) + " miles"; return message; |
String | formatToastTemp(String message, int value, String unit) format Toast Temp if (unit.equals("c")) message += ": " + value + "?C"; else message += ":" + CelciusToFahrenheit(value) + "?F"; return message; |
void | showMessage(final Activity activity, final String message) show Message activity.runOnUiThread(new Runnable() { public void run() { Toast.makeText(activity, message, Toast.LENGTH_LONG).show(); }); |
void | showToast(Activity activity, String message) show Toast Toast.makeText(activity.getApplicationContext(), message, Toast.LENGTH_SHORT).show(); |
void | showToast(final Activity ctx, final String text, final int position, final boolean alive) show Toast ctx.runOnUiThread(new Runnable() { @Override public void run() { if (!alive) { return; Toast toast = Toast.makeText(ctx, text, Toast.LENGTH_SHORT); toast.setGravity(position, 0, 0); ... |
void | makeToast(String msg, int length, Activity mainAct) make Toast Toast.makeText(mainAct, msg, length).show(); |
void | displayToast(String message, Activity activity) display Toast Toast toast = Toast.makeText(activity, message, Toast.LENGTH_SHORT); toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); toast.show(); |
void | showToast(Context context, String message) show Toast Toast.makeText(context, message, Toast.LENGTH_LONG).show(); |
void | showToast(Context context, int id) show Toast if (null != context) {
Toast.makeText(context, id, Toast.LENGTH_SHORT).show();
|
void | showToast(Context context, int stringId) show Toast Toast toast = Toast.makeText(context, context.getString(stringId), Toast.LENGTH_LONG); toast.show(); |