List of usage examples for android.content Intent putExtra
@Deprecated
@UnsupportedAppUsage
public @NonNull Intent putExtra(String name, IBinder value)
From source file:Main.java
public static void sendEmail(Context context, String receiver, String subject, String body) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { receiver }); intent.putExtra(Intent.EXTRA_SUBJECT, subject); try {// w ww.j a va 2 s . com context.startActivity(Intent.createChooser(intent, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { } }
From source file:com.phunkosis.gifstitch.helpers.ShareHelper.java
public static void startShareLinkIntent(Activity activity, String url) { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_TEXT, activity.getResources().getString(R.string.share_link_body) + " " + url); intent.putExtra(Intent.EXTRA_SUBJECT, activity.getResources().getString(R.string.share_link_subject)); intent.setType("text/plain"); activity.startActivity(Intent.createChooser(intent, "Share ")); }
From source file:fr.julienvermet.bugdroid.service.ProductsIntentService.java
public static Intent getIntent(Context context, Instance instance, boolean forceReload) { Intent intent = new Intent(context, ProductsIntentService.class); String query = instance.url + CONFIGURATION_SUFFIX; intent.putExtra(QUERY, query); intent.putExtra(INSTANCES_ID, instance._id); Account account = instance.account;//from www . j a v a 2s .c o m if (account != null) { intent.putExtra(ACCOUNTS_ID, account._id); } intent.putExtra(FORCE_RELOAD, forceReload); return intent; }
From source file:com.locadz.AdUnitAllocationService.java
/** * Create an intent that will trigger this service. * @param context the context to send the intent to. * @param adUnitContext the adUnitContext for the receiving {@link AdUnitLayout}. * * @return an intent that will trigger this service. */// ww w.jav a 2s . co m public static Intent createIntent(Context context, AdUnitContext adUnitContext) { Intent ret = new Intent(context, AdUnitAllocationService.class); ret.putExtra(IntentConstants.EXTRA_ADUNIT_CONTEXT, adUnitContext); return ret; }
From source file:Main.java
public static void installApk(Context context, File file) { if (context != null && isFileExists(file)) { Uri uri = Uri.fromFile(new File(file.getAbsolutePath())); Intent installIntent = new Intent(); installIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); installIntent.setAction(Intent.ACTION_VIEW); String type = "application/vnd.android.package-archive"; installIntent.putExtra("loadapk", "loadapk"); installIntent.setDataAndType(uri, type); context.startActivity(installIntent); }// w w w . j a v a 2 s . co m }
From source file:com.skubit.iab.activities.TransactionDetailsActivity.java
public static Intent newIntent(String data, String packageName) { Intent intent = new Intent(); intent.setClassName(packageName, TransactionDetailsActivity.class.getName()); intent.putExtra("transaction", data); return intent; }
From source file:Main.java
public static void sendEmail(Context ctx, String[] emailAddresses, String[] CCAddresses, String subject, String message) {/*ww w .j av a 2 s . c o m*/ Intent emailIntent = new Intent(Intent.ACTION_SEND); // emailIntent.setType("text/plain"); emailIntent.setData(Uri.parse("mailto:")); String[] to = emailAddresses; String[] cc = CCAddresses; emailIntent.putExtra(Intent.EXTRA_EMAIL, to); if (CCAddresses != null) { emailIntent.putExtra(Intent.EXTRA_CC, cc); } emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, message); emailIntent.setType("message/rfc822"); ctx.startActivity(Intent.createChooser(emailIntent, "Email")); }
From source file:com.bluros.updater.service.DownloadService.java
public static void start(Context context, UpdateInfo ui) { Intent intent = new Intent(context, DownloadService.class); intent.putExtra(EXTRA_UPDATE_INFO, (Parcelable) ui); context.startService(intent);/*from w ww . j a v a 2 s . c o m*/ }
From source file:gov.nasa.arc.geocam.talk.UIUtils.java
/** * Show the {@link GeoCamTalkMapActivity} for a given message. * * @param context The current activity context * @param talkMessage The {@link GeoCamTalkMessage} that the map activity will display */// w w w. j a va 2 s. co m public static void showMapView(Context context, GeoCamTalkMessage talkMessage) { final Intent intent = new Intent(context, GeoCamTalkMapActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(context.getString(R.string.latitude), talkMessage.getLatitude()); intent.putExtra(context.getString(R.string.longitude), talkMessage.getLongitude()); intent.putExtra(context.getString(R.string.accuracy), talkMessage.getAccuracy()); context.startActivity(intent); }
From source file:Main.java
public static void send(Context context, String path) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); PackageManager pm = context.getPackageManager(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setType("*/*"); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(path))); List<ResolveInfo> list = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); boolean flag = false; for (ResolveInfo info : list) { if (info.activityInfo.packageName.toLowerCase().contains("bluetooth") || info.activityInfo.name.toLowerCase().contains("bluetooth")) { ApplicationInfo appInfo = null; try { appInfo = pm.getApplicationInfo(info.activityInfo.packageName, PackageManager.GET_META_DATA); } catch (PackageManager.NameNotFoundException e) { }/*from ww w. jav a2 s. c o m*/ if (appInfo != null && (appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) == 0 && (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { intent.setClassName(info.activityInfo.packageName, info.activityInfo.name); flag = true; break; } } } if (!flag) { return; } context.startActivity(intent); }