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:com.chatwing.whitelabel.managers.ChatboxModeManager.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem notificationItem = menu.findItem(R.id.manage_notification); if (notificationItem != null) { if (mCurrentChatBoxManager.getCurrentChatBox() == null || mCurrentChatBoxManager.getCurrentChatBox().getNotificationStatus() == null || mUserManager.getCurrentUser() == null) { notificationItem.setVisible(false); } else {// ww w. ja va2 s.c o m notificationItem.setVisible(true); } } MenuItem shareChatBoxItem = menu.findItem(R.id.share_chat_box); MenuItem copyAliasItem = menu.findItem(R.id.copy_alias); MenuItem manageBlackListItem = menu.findItem(R.id.manage_blacklist); MenuItem bookmarkChatBoxItem = menu.findItem(R.id.bookmark_chat_box); MenuItem onlineUsersItem = menu.findItem(R.id.online_users); // Invalidate all menu related objects onlineUsersItem.setVisible(false); mOnlineUsersBadgeView.hide(); shareChatBoxItem.setVisible(false); copyAliasItem.setVisible(false); manageBlackListItem.setVisible(false); bookmarkChatBoxItem.setVisible(false); mediaAddItem.setVisible(false); // Now config them if (mCurrentChatBoxManager.getCurrentChatBox() != null) { // When main view or online users drawer is opened // and current chat box is available. onlineUsersItem.setVisible(true); shareChatBoxItem.setVisible(true && Constants.ALLOW_SHARE_CHATBOX); if (mNumOfOnlineUser > 0) { mOnlineUsersBadgeView.setText(Integer.toString(mNumOfOnlineUser)); mOnlineUsersBadgeView.show(); } // Config share intent for share chat box item AppCompatActivity activity = mActivityDelegate.getActivity(); ChatBox chatBox = mCurrentChatBoxManager.getCurrentChatBox(); String shareText = mApiManager.getChatBoxUrl(chatBox.getKey()); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.message_share_chat_box_subject)); intent.putExtra(Intent.EXTRA_TEXT, shareText); ShareActionProvider shareChatBoxActionProvider = (ShareActionProvider) MenuItemCompat .getActionProvider(shareChatBoxItem); shareChatBoxActionProvider.setShareIntent(intent); if (mBuildManager.isOfficialChatWingApp() && mUserManager.userCanBookmark() && !ChatWingContentProvider .hasSyncedBookmarkInDB(activity.getContentResolver(), chatBox.getId())) { bookmarkChatBoxItem.setVisible(true); } if (mBuildManager.isSupportedMusicBox()) { mediaAddItem.setVisible(true); } if (chatBox.getAlias() != null && Constants.ALLOW_SHARE_CHATBOX) { copyAliasItem.setVisible(true); } if (mUserManager.userHasPermission(chatBox, PermissionsValidator.Permission.UNBLOCK_USER)) { manageBlackListItem.setVisible(true); } updateControlUI(chatBox); } return true; }
From source file:aerizostudios.com.cropshop.MainActivity.java
@Override public void onMenuItemClick(View clickedView, int position) { if (position == 1) { AlertDialog.Builder alert = new AlertDialog.Builder(this); LayoutInflater inflater = (LayoutInflater) getApplicationContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.photo_quality, null); alert.setView(v);//from w w w . ja v a2s .c o m alert.setTitle("Select Photo Quality"); alert.setPositiveButton("OKAY", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (normal.isChecked()) { prefs = getSharedPreferences(prefName, MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putInt("res", 300); editor.commit(); } else { prefs = getSharedPreferences(prefName, MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putInt("res", 400); editor.commit(); } prefs = getSharedPreferences(prefName, MODE_PRIVATE); quality = prefs.getInt("res", 0); } }); alert.setNegativeButton("CANCEL", null); AlertD = alert.create(); AlertD.show(); normal = (RadioButton) AlertD.findViewById(R.id.normalQuality); high = (RadioButton) AlertD.findViewById(R.id.highQuality); Log.d("alert pref", "alert pref" + quality); if (quality == 300) normal.setChecked(true); else high.setChecked(true); } if (position == 2) { Uri uri = Uri.parse("market://details?id=" + getPackageName()); Intent myAppLinkToMarket = new Intent(Intent.ACTION_VIEW, uri); try { startActivity(myAppLinkToMarket); } catch (ActivityNotFoundException e) { Toast.makeText(this, " unable to find market app", Toast.LENGTH_LONG).show(); } } if (position == 3) { try { Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, "CROP SHOP"); String sAux = "\nHey friends, Check out this COOL APP - CropShop - No Crop for Whatsapp and" + " Instagram. This app helps you post images on Whatsapp and Instagram without any need " + "of cropping them. It also adds Blur Effect to the Photos like Iphone and also" + " Instagram filters." + "This app allows you to share the photos" + " directly to Instagram,Facebook and Whatsapp from the App.\n" + "Download this app from the play store.\n"; sAux = sAux + "https://play.google.com/store/apps/details?id=aerizostudios.com.cropshop \n\n"; i.putExtra(Intent.EXTRA_TEXT, sAux); startActivity(Intent.createChooser(i, "choose one")); } catch (Exception e) { //e.toString(); } } if (position == 4) { startActivity(new Intent(this, Feedback.class)); } }
From source file:com.adkdevelopment.earthquakesurvival.ui.DetailFragment.java
/** * Sets a share intent on ShareActionProvider */// ww w . j a va2s .com private void setShareIntent() { if (mShareActionProvider != null) { Intent intent = new Intent(Intent.ACTION_SEND); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, getString(R.string.earthquake_magnitude, mMagnitude) + "\n" + mDate + "\n" + mDescription + "\n" + mDistance + "\n" + getString(R.string.earthquake_depth, mDepth) + "\n" + mLink); mShareActionProvider.setShareIntent(intent); } else { Log.e(TAG, "ShareActionProvider is null"); } }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { getActivity().finish();/* w w w . j a va 2 s . co m*/ return true; } case R.id.AddLog: { try { addMessageDialog = new Dialog(getActivity()); addMessageDialog.setContentView(R.layout.add_message); addMessageDialog.setTitle("Add Message to Event Log"); ((Button) addMessageDialog.findViewById(R.id.SaveButton)) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AddLogMessage(((EditText) addMessageDialog.findViewById(R.id.LogMessage)).getText() .toString()); addMessageDialog.dismiss(); } }); addMessageDialog.show(); return true; } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "AddLog", e); return false; } } case R.id.escalate: { try { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); // Add data to the intent, the receiving app will decide what to do with it. intent.putExtra(Intent.EXTRA_SUBJECT, "Escalation of Zenoss Event on " + Title.getText()); String EventDetails = Summary.getText() + "\r\r\n" + LastTime.getText() + "\r\r\n" + "Count: " + EventCount.getText(); intent.putExtra(Intent.EXTRA_TEXT, EventDetails); startActivity(Intent.createChooser(intent, "How would you like to escalate this event?")); return true; } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "escalate", e); return false; } } default: { return false; } } }
From source file:bander.notepad.NoteEditAppCompat.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();/* w ww. ja va 2 s. co m*/ return true; case R.id.home: onBackPressed(); return true; case DELETE_ID: deleteNote(this, mUri); return true; case REVERT_ID: mBodyText.setTextKeepState(mOriginalNote.getBody()); return true; case SEND_ID: Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, mBodyText.getText().toString()); startActivity(Intent.createChooser(intent, getString(R.string.menu_send))); return true; case PREFS_ID: Intent prefsActivity = new Intent(this, PrefsActivityAppCompat.class); startActivity(prefsActivity); return true; } return super.onOptionsItemSelected(item); }
From source file:com.mbientlab.metawear.app.SensorFragment.java
@Override public void onViewCreated(final View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); chart = (LineChart) view.findViewById(R.id.data_chart); initializeChart();/*from w w w. j a va 2s . com*/ resetData(false); chart.invalidate(); view.findViewById(R.id.data_clear).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { chart.resetTracking(); chart.clear(); resetData(true); chart.invalidate(); } }); ((Switch) view.findViewById(R.id.sample_control)) .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (b) { moveViewToLast(); setup(); chartHandler.postDelayed(updateChartTask, UPDATE_PERIOD); } else { chart.setVisibleXRangeMaximum(sampleCount); clean(); if (streamRouteManager != null) { streamRouteManager.remove(); streamRouteManager = null; } chartHandler.removeCallbacks(updateChartTask); } } }); view.findViewById(R.id.data_save).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String filename = saveData(); if (filename != null) { File dataFile = getActivity().getFileStreamPath(filename); Uri contentUri = FileProvider.getUriForFile(getActivity(), "com.mbientlab.metawear.app.fileprovider", dataFile); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, filename); intent.putExtra(Intent.EXTRA_STREAM, contentUri); startActivity(Intent.createChooser(intent, "Saving Data")); } } }); }
From source file:com.codeskraps.sbrowser.home.SBrowserActivity.java
@SuppressLint("NewApi") @Override/*from www . jav a 2s . c om*/ public boolean onContextItemSelected(MenuItem item) { Log.v(TAG, "onContextItemSelected"); WebView.HitTestResult result = webView.getHitTestResult(); Log.d(TAG, "result: " + result.getExtra()); Intent sharingIntent = new Intent(Intent.ACTION_SEND); switch (item.getItemId()) { case R.id.itemSaveImage: case R.id.itemSaveLink: try { DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); Request request = new Request(Uri.parse(result.getExtra())); dm.enqueue(request); } catch (Exception e) { Toast.makeText(this, "sBrowser - Error saving...", Toast.LENGTH_SHORT).show(); Log.d(TAG, "Erro Downloading: " + e); } break; case R.id.itemCopyLink: if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); clipboard.setText(result.getExtra()); } else { android.content.ClipboardManager newClipboard = (android.content.ClipboardManager) getSystemService( CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("label", result.getExtra()); newClipboard.setPrimaryClip(clip); } break; case R.id.itemShareLink: try { sharingIntent.setType("text/html"); sharingIntent.putExtra(Intent.EXTRA_TEXT, result.getExtra()); startActivity(Intent.createChooser(sharingIntent, "Share using...")); } catch (Exception e) { e.printStackTrace(); Log.d(TAG, "Erro Sharing link: " + e); } break; case R.id.itemShareImage: try { sharingIntent.setType("image/*"); sharingIntent.putExtra(Intent.EXTRA_STREAM, result.getExtra()); startActivity(Intent.createChooser(sharingIntent, "Share image using...")); } catch (Exception e) { e.printStackTrace(); Log.d(TAG, "Erro Sharing Image: " + e); } break; } return super.onContextItemSelected(item); }
From source file:com.bt.download.android.gui.activities.MainActivity.java
@Override protected void onNewIntent(Intent intent) { if (isShutdown(intent)) { return;//from w ww. j av a 2 s. c om } String action = intent.getAction(); //onResumeFragments(); if (action != null && action.equals(Constants.ACTION_SHOW_TRANSFERS)) { if (Ads.isLoaded(Fetcher.AdFormat.interstitial, Constants.TAG_INTERSTITIAL_WIDGET)) { Ads.showAppWidget(this, null, Constants.TAG_INTERSTITIAL_WIDGET, Ads.ShowMode.FULL_SCREEN); } controller.showTransfers(TransferStatus.ALL); } else if (action != null && action.equals(Constants.ACTION_OPEN_TORRENT_URL)) { //Open a Torrent from a URL or from a local file :), say from Astro File Manager. /** * TODO: Ask @aldenml the best way to plug in NewTransferDialog. * I've refactored this dialog so that it is forced (no matter if the setting * to not show it again has been used) and when that happens the checkbox is hidden. * * However that dialog requires some data about the download, data which is not * obtained until we have instantiated the Torrent object. * * I'm thinking that we can either: * a) Pass a parameter to the transfer manager, but this would probably * not be cool since the transfer manager (I think) should work independently from * the UI thread. * * b) Pass a "listener" to the transfer manager, once the transfer manager has the torrent * it can notify us and wait for the user to decide wether or not to continue with the transfer * * c) Forget about showing that dialog, and just start the download, the user can cancel it. */ //Show me the transfer tab Intent i = new Intent(this, MainActivity.class); i.setAction(Constants.ACTION_SHOW_TRANSFERS); i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(i); //go! TransferManager.instance().downloadTorrent(intent.getDataString()); } // When another application wants to "Share" a file and has chosen FrostWire to do so. // We make the file "Shared" so it's visible for other FrostWire devices on the local network. else if (action != null && (action.equals(Intent.ACTION_SEND) || action.equals(Intent.ACTION_SEND_MULTIPLE))) { controller.handleSendAction(intent); } if (intent.hasExtra(Constants.EXTRA_DOWNLOAD_COMPLETE_NOTIFICATION)) { controller.showTransfers(TransferStatus.COMPLETED); TransferManager.instance().clearDownloadsToReview(); try { ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) .cancel(Constants.NOTIFICATION_DOWNLOAD_TRANSFER_FINISHED); Bundle extras = intent.getExtras(); if (extras.containsKey(Constants.EXTRA_DOWNLOAD_COMPLETE_PATH)) { File file = new File(extras.getString(Constants.EXTRA_DOWNLOAD_COMPLETE_PATH)); if (file.isFile()) { UIUtils.openFile(this, file.getAbsoluteFile()); } } } catch (Throwable e) { LOG.warn("Error handling download complete notification", e); } } }
From source file:pl.bcichecki.rms.client.android.fragments.DevicesListFragment.java
private void performActionShare(final ActionMode mode, MenuItem item, final Device selectedDevice) { ShareActionProvider shareActionProvider = (ShareActionProvider) item.getActionProvider(); if (shareActionProvider != null) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(AppConstants.CONTENT_TEXT_PLAIN); intent.putExtra(Intent.EXTRA_TEXT, new DeviceTextPrettyPrinterPrinter(getActivity()).print(selectedDevice)); shareActionProvider.setShareHistoryFileName(null); shareActionProvider.setShareIntent(intent); Log.d(TAG, "Device " + selectedDevice + " was succesfully shared."); }/*from w w w. ja v a 2s . com*/ }