List of usage examples for android.content Intent ACTION_SEND
String ACTION_SEND
To view the source code for android.content Intent ACTION_SEND.
Click Source Link
From source file:de.petendi.ethereum.android.EthereumAndroid.java
public void requestSignature(Activity parentActivity, int requestCode, String hexEncodedMessage) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setPackage(EthereumAndroidFactory.PACKAGENAME); intent.setData(Uri.parse("eth:sign/" + hexEncodedMessage)); parentActivity.startActivityForResult(intent, requestCode); }
From source file:org.exoplatform.shareextension.ShareActivity.java
private boolean isIntentCorrect() { Intent intent = getIntent();/*from w ww . j a va 2 s . co m*/ String action = intent.getAction(); String type = intent.getType(); mMultiFlag = Intent.ACTION_SEND_MULTIPLE.equals(action); return ((Intent.ACTION_SEND.equals(action) || mMultiFlag) && type != null); }
From source file:com.codebutler.farebot.activity.AdvancedCardInfoActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { try {//w ww .j a v a2 s . c o m if (item.getItemId() == R.id.copy_xml) { String xml = mCard.toXml(FareBotApplication.getInstance().getSerializer()); @SuppressWarnings("deprecation") ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); clipboard.setText(xml); Toast.makeText(this, "Copied to clipboard.", Toast.LENGTH_SHORT).show(); return true; } else if (item.getItemId() == R.id.share_xml) { String xml = mCard.toXml(FareBotApplication.getInstance().getSerializer()); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, xml); startActivity(intent); return true; } else if (item.getItemId() == android.R.id.home) { finish(); return true; } } catch (Exception ex) { new AlertDialog.Builder(this).setMessage(ex.toString()).show(); } return false; }
From source file:com.example.igorklimov.popularmoviesdemo.fragments.DetailFragment.java
private Intent createShareIntent() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, "#Popular Movies app https://www.youtube.com/watch?v=" + mTrailerUri); return intent; }
From source file:com.dnielfe.manager.AppManager.java
@Override public boolean onContextItemSelected(MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); int index = info.position; String packagename = mAppList.get(index).packageName; switch (item.getItemId()) { case ID_LAUNCH: Intent i = pm.getLaunchIntentForPackage(packagename); startActivity(i);/* www .ja v a2s. c om*/ break; case ID_MANAGE: startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + packagename))); break; case ID_UNINSTALL: Intent i1 = new Intent(Intent.ACTION_DELETE); i1.setData(Uri.parse("package:" + packagename)); startActivity(i1); get_downloaded_apps(); break; case ID_MARKET: Intent intent1 = new Intent(Intent.ACTION_VIEW); intent1.setData(Uri.parse("market://details?id=" + packagename)); startActivity(intent1); break; case ID_SEND: try { ApplicationInfo info1 = pm.getApplicationInfo(packagename, 0); String source_dir = info1.sourceDir; File file = new File(source_dir); Uri uri11 = Uri.fromFile(file.getAbsoluteFile()); Intent infointent = new Intent(Intent.ACTION_SEND); infointent.setType("application/zip"); infointent.putExtra(Intent.EXTRA_STREAM, uri11); startActivity(Intent.createChooser(infointent, getString(R.string.share))); } catch (Exception e) { Toast.makeText(AppManager.this, "Error", Toast.LENGTH_SHORT).show(); } break; } return false; }
From source file:com.chen.mail.widget.WidgetService.java
public static void configureValidWidgetIntents(Context context, RemoteViews remoteViews, int appWidgetId, Account account, final int folderType, final Uri folderUri, final Uri folderConversationListUri, final String folderDisplayName, Class<?> serviceClass) { remoteViews.setViewVisibility(R.id.widget_configuration, View.GONE); // Launch an intent to avoid ANRs final Intent intent = new Intent(context, serviceClass); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); intent.putExtra(Utils.EXTRA_ACCOUNT, account.serialize()); intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_TYPE, folderType); intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_URI, folderUri); intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_CONVERSATION_LIST_URI, folderConversationListUri); intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_DISPLAY_NAME, folderDisplayName); intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))); remoteViews.setRemoteAdapter(R.id.conversation_list, intent); // Open mail app when click on header final Intent mailIntent = Utils.createViewFolderIntent(context, folderUri, account); PendingIntent clickIntent = PendingIntent.getActivity(context, 0, mailIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent); // On click intent for Compose final Intent composeIntent = new Intent(); composeIntent.setAction(Intent.ACTION_SEND); composeIntent.putExtra(Utils.EXTRA_ACCOUNT, account.serialize()); composeIntent.setData(account.composeIntentUri); composeIntent.putExtra(ComposeActivity.EXTRA_FROM_EMAIL_TASK, true); if (account.composeIntentUri != null) { composeIntent.putExtra(Utils.EXTRA_COMPOSE_URI, account.composeIntentUri); }/*from w ww. j av a2s .c o m*/ // Build a task stack that forces the conversation list on the stack before the compose // activity. final TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context); clickIntent = taskStackBuilder.addNextIntent(mailIntent).addNextIntent(composeIntent).getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setOnClickPendingIntent(R.id.widget_compose, clickIntent); // On click intent for Conversation final Intent conversationIntent = new Intent(); conversationIntent.setAction(Intent.ACTION_VIEW); clickIntent = PendingIntent.getActivity(context, 0, conversationIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setPendingIntentTemplate(R.id.conversation_list, clickIntent); }
From source file:com.piusvelte.sonet.core.SonetCreatePost.java
@Override protected void onResume() { super.onResume(); Intent intent = getIntent();//from w ww .j a v a 2 s . co m if (intent != null) { String action = intent.getAction(); if ((action != null) && action.equals(Intent.ACTION_SEND)) { if (intent.hasExtra(Intent.EXTRA_STREAM)) getPhoto((Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM)); if (intent.hasExtra(Intent.EXTRA_TEXT)) { final String text = intent.getStringExtra(Intent.EXTRA_TEXT); mMessage.setText(text); mCount.setText(Integer.toString(text.length())); } chooseAccounts(); } else { Uri data = intent.getData(); if ((data != null) && data.toString().contains(Accounts.getContentUri(this).toString())) { // default to the account passed in, but allow selecting additional accounts Cursor account = this.getContentResolver().query(Accounts.getContentUri(this), new String[] { Accounts._ID, Accounts.SERVICE }, Accounts._ID + "=?", new String[] { data.getLastPathSegment() }, null); if (account.moveToFirst()) mAccountsService.put(account.getLong(0), account.getInt(1)); account.close(); } else if (intent.hasExtra(Widgets.INSTANT_UPLOAD)) { // check if a photo path was passed and prompt user to select the account setPhoto(intent.getStringExtra(Widgets.INSTANT_UPLOAD)); chooseAccounts(); } } } }
From source file:com.android.mail.widget.WidgetService.java
public static void configureValidWidgetIntents(Context context, RemoteViews remoteViews, int appWidgetId, Account account, final int folderType, final int folderCapabilities, final Uri folderUri, final Uri folderConversationListUri, final String folderDisplayName, Class<?> serviceClass) { remoteViews.setViewVisibility(R.id.widget_configuration, View.GONE); // Launch an intent to avoid ANRs final Intent intent = new Intent(context, serviceClass); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); intent.putExtra(Utils.EXTRA_ACCOUNT, account.serialize()); intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_TYPE, folderType); intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_CAPABILITIES, folderCapabilities); intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_URI, folderUri); intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_CONVERSATION_LIST_URI, folderConversationListUri); intent.putExtra(BaseWidgetProvider.EXTRA_FOLDER_DISPLAY_NAME, folderDisplayName); intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME))); remoteViews.setRemoteAdapter(R.id.conversation_list, intent); // Open mail app when click on header final Intent mailIntent = Utils.createViewFolderIntent(context, folderUri, account); mailIntent.setPackage(context.getPackageName()); PendingIntent clickIntent = PendingIntent.getActivity(context, 0, mailIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setOnClickPendingIntent(R.id.widget_header, clickIntent); // On click intent for Compose final Intent composeIntent = new Intent(); composeIntent.setPackage(context.getPackageName()); composeIntent.setAction(Intent.ACTION_SEND); composeIntent.putExtra(Utils.EXTRA_ACCOUNT, account.serialize()); composeIntent.setData(account.composeIntentUri); composeIntent.putExtra(ComposeActivity.EXTRA_FROM_EMAIL_TASK, true); if (account.composeIntentUri != null) { composeIntent.putExtra(Utils.EXTRA_COMPOSE_URI, account.composeIntentUri); }// ww w .j a v a 2s.c o m // Build a task stack that forces the conversation list on the stack before the compose // activity. final TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context); clickIntent = taskStackBuilder.addNextIntent(mailIntent).addNextIntent(composeIntent).getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setOnClickPendingIntent(R.id.widget_compose, clickIntent); // On click intent for Conversation final Intent conversationIntent = new Intent(); conversationIntent.setPackage(context.getPackageName()); conversationIntent.setAction(Intent.ACTION_VIEW); clickIntent = PendingIntent.getActivity(context, 0, conversationIntent, PendingIntent.FLAG_UPDATE_CURRENT); remoteViews.setPendingIntentTemplate(R.id.conversation_list, clickIntent); }
From source file:br.com.anteros.vendas.gui.ManutencaoTabelasActivity.java
private void selecionarArquivoCompartilhar() { File importFolder = new File(Environment.getExternalStorageDirectory() + "/backup/"); final File importFiles[] = importFolder.listFiles(); if (importFiles == null || importFiles.length == 0) { Toast.makeText(this, "Pasta de backup vazia", Toast.LENGTH_SHORT).show(); return;//w ww. j a v a 2 s. c o m } AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Selecionar arquivo:"); builder.setSingleChoiceItems(importFolder.list(), 0, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { File importDatabaseFile = importFiles[whichButton]; Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("*/*"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "File Name"); emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(importDatabaseFile)); startActivity(Intent.createChooser(emailIntent, "Share File")); dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); }
From source file:com.liquid.wallpapers.free.ScroidWallpaperGallery.java
private void handleOnCommunicationChosen(Communication communication) { Wallpaper wallpaper = this.selectedWallpaper; if (communication.getType().equals(Communication.Type.Email)) { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { communication.getValue() }); intent.putExtra(Intent.EXTRA_SUBJECT, getBaseContext().getString(R.string.applicationName)); intent.putExtra(Intent.EXTRA_TEXT, String.format( getBaseContext().getString(R.string.recommendEmailPattern), wallpaper.getWallpaperUrl())); intent.setType(Messages.getString("ScroidWallpaperGallery.0")); //$NON-NLS-1$ this.startActivity(intent); } else if (communication.getType().equals(Communication.Type.Mobile)) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.putExtra(Messages.getString("ScroidWallpaperGallery.1"), communication.getValue()); //$NON-NLS-1$ intent.putExtra(Messages.getString("ScroidWallpaperGallery.2"), //$NON-NLS-1$ String.format(getBaseContext().getString(R.string.recommendSmsPattern), wallpaper.getWallpaperUrl())); intent.setType(Messages.getString("ScroidWallpaperGallery.3")); //$NON-NLS-1$ this.startActivity(intent); }/* w w w . j a va2s . com*/ }