List of usage examples for android.widget Toast LENGTH_LONG
int LENGTH_LONG
To view the source code for android.widget Toast LENGTH_LONG.
Click Source Link
From source file:Main.java
public static void getAuthorityFromPermission(Activity context) { String read_settings = "com.android.launcher.permission.READ_SETTINGS"; String write_settings = "com.android.launcher.permission.WRITE_SETTINGS"; List<PackageInfo> packs = context.getPackageManager().getInstalledPackages(PackageManager.GET_PROVIDERS); if (packs != null) { for (PackageInfo pack : packs) { ProviderInfo[] providers = pack.providers; if (providers != null) { for (ProviderInfo provider : providers) { if ((read_settings.equals(provider.readPermission) || (write_settings.equals(provider.writePermission)))) { Toast.makeText(context, pack.applicationInfo.packageName, Toast.LENGTH_LONG).show(); if (isExistShortcut(context, provider.authority)) { continue; } else { /* * ShotcutUtil.createShortcut(context, SplashActivity.class, * R.string.app_name, R.drawable.icon, false); *//*from w ww . j a v a 2 s. c om*/ continue; } } } } } } return; }
From source file:Main.java
public static void toast(Context context, CharSequence message, Object... args) { if (message != null) { String messageString = message.toString(); if (args != null) { messageString = String.format(messageString, args); }/* w ww . j a v a 2s . c o m*/ Toast.makeText(context, messageString, Toast.LENGTH_LONG).show(); } }
From source file:Main.java
public static Toast showHint(Context context, String text) { Toast t = Toast.makeText(context, text, Toast.LENGTH_LONG); t.show(); return t; }
From source file:Main.java
public static void copyToClipboard(Context context, String label, String string, int toastMessageId) { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(label, string); clipboard.setPrimaryClip(clip);// w w w . j av a 2 s. com if (toastMessageId > 0) { Toast.makeText(context, toastMessageId, Toast.LENGTH_LONG).show(); } }
From source file:Main.java
/** * Shows toast message with given message for a long time. * * @param text message to show/*from w ww . j a v a 2s . co m*/ * @see #showShort(android.content.Context, CharSequence) */ @NonNull public static Toast showLong(@NonNull Context context, @NonNull CharSequence text) { return show(context, text, Toast.LENGTH_LONG); }
From source file:Main.java
/** * Method to open app/*from w ww . j av a 2 s . c o m*/ * * @param context */ public static void openApp(Context context, String appPackage) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackage)); if (isConnectionAvailable(context) && isIntentAvailable(context, intent)) { // SET THAT REVIEW IS DONE SharedPreferences sharedPreferences = context.getSharedPreferences(REVIEW_DONE, Context.MODE_PRIVATE); Editor edit = sharedPreferences.edit(); edit.putBoolean(REVIEW_DONE, true); edit.commit(); // START REVIEW ACTIVITY context.startActivity(intent); } else { Toast.makeText(context, "Network Error", Toast.LENGTH_LONG).show(); } }
From source file:Main.java
/** * Method to send review// www . j a v a 2 s . com * * @param context */ public static void sendReview(Context context) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())); if (isConnectionAvailable(context) && isIntentAvailable(context, intent)) { // SET THAT REVIEW IS DONE SharedPreferences sharedPreferences = context.getSharedPreferences(REVIEW_DONE, Context.MODE_PRIVATE); Editor edit = sharedPreferences.edit(); edit.putBoolean(REVIEW_DONE, true); edit.commit(); // START REVIEW ACTIVITY context.startActivity(intent); } else { Toast.makeText(context, "Network Error", Toast.LENGTH_LONG).show(); } }
From source file:Main.java
public static void launchMarket(Context c) { Uri uri = Uri.parse("market://details?id=" + c.getPackageName()); // debug only Uri uri = //Uri.parse("https://market.android.com/details?id=" + getPackageName()); Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri); try {//www . j ava 2 s .co m c.startActivity(goToMarket); } catch (ActivityNotFoundException e) { Toast.makeText(c, "XXX" /* R.string.couldnt_launch_market */, Toast.LENGTH_LONG).show(); } }
From source file:Main.java
/** * Long toast message// w w w .jav a 2 s . co m * * @param context Application Context * @param msg Message to send */ public static void msgLong(Context context, String msg) { if (context != null && msg != null) { Toast.makeText(context, msg.trim(), Toast.LENGTH_LONG).show(); } }
From source file:Main.java
public static boolean startLastActivity(Activity activity) { try {/*from ww w. j av a 2 s .co m*/ BufferedReader reader = new BufferedReader(new InputStreamReader(activity.openFileInput(FILENAME))); String nextClassName = reader.readLine(); reader.close(); if (null == nextClassName || nextClassName.length() < 3) { return false; } String currClassName = activity.getClass().getName(); if (currClassName.equals(nextClassName)) { return false; } @SuppressWarnings("unchecked") Class<? extends Activity> clazz = (Class<? extends Activity>) Class.forName(nextClassName); if (null == clazz) { return false; } Intent i = new Intent(activity, clazz); activity.startActivity(i); activity.finish(); reader.close(); return true; } catch (Exception e) { Toast.makeText(activity, "startLastActivity: " + e, Toast.LENGTH_LONG).show(); } return false; }