List of usage examples for android.widget Toast LENGTH_SHORT
int LENGTH_SHORT
To view the source code for android.widget Toast LENGTH_SHORT.
Click Source Link
From source file:Main.java
public static void showToask(Context context, String tip) { Toast.makeText(context, tip, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
public static void showToast(Context context, String message) { new Handler(Looper.getMainLooper()).post(() -> { Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); });// w w w . j a va2s. c om }
From source file:Main.java
public static void openCamera(Context context, int code) { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT, context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new ContentValues())); // intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(Environment.getExternalStorageDirectory() + imagePath))); ((Activity) context).startActivityForResult(intent, code); } else// w ww .j a va2 s. com Toast.makeText(context, "no sdcard!", Toast.LENGTH_SHORT).show(); }
From source file:Main.java
public static void showToast(Context context, int id, boolean longToast) { Toast.makeText(context, id, longToast ? Toast.LENGTH_LONG : Toast.LENGTH_SHORT).show(); }
From source file:Main.java
public static void showToast(Context context, String msg) { Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
public static void showToast(Context context, int res) { Toast.makeText(context, res, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
public static void sendMail(Context context, String[] mail, String subject, String body) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); // i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"}); // i.putExtra(Intent.EXTRA_SUBJECT, "subject of email"); // i.putExtra(Intent.EXTRA_TEXT , "body of email"); i.putExtra(Intent.EXTRA_EMAIL, mail); i.putExtra(Intent.EXTRA_SUBJECT, subject); i.putExtra(Intent.EXTRA_TEXT, body); try {/*from w w w . jav a 2s . com*/ context.startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(context, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } }
From source file:Main.java
static void showShortToastMessage(Context context, int messageId) { Toast.makeText(context, messageId, Toast.LENGTH_SHORT).show(); }
From source file:Main.java
public static void toastMessage(Context context, int resId) { if (context == null) { return;/*from w ww .ja v a 2 s . c o m*/ } if (sToast != null) { sToast.cancel(); sToast = null; } sToast = getToast(context); sToast.setDuration(Toast.LENGTH_SHORT); sToast.setText(resId); sToast.show(); }
From source file:Main.java
public static void showHint(final Context c, String hintText, boolean makeItAQuickOne) { int duration = makeItAQuickOne ? Toast.LENGTH_SHORT : Toast.LENGTH_LONG; Toast t = Toast.makeText(c, hintText, duration); t.setGravity(Gravity.CENTER_VERTICAL, 0, 0); t.show();//from w w w .j a v a 2s . c o m }