List of usage examples for android.content Intent EXTRA_TITLE
String EXTRA_TITLE
To view the source code for android.content Intent EXTRA_TITLE.
Click Source Link
From source file:com.android.launcher2.Launcher.java
void processShortcut(Intent intent) { // Handle case where user selected "Applications" String applicationName = getResources().getString(R.string.group_applications); String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); if (applicationName != null && applicationName.equals(shortcutName)) { Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY); pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent); pickIntent.putExtra(Intent.EXTRA_TITLE, getText(R.string.title_select_application)); startActivityForResultSafely(pickIntent, REQUEST_PICK_APPLICATION); } else {/*from w w w . j a va 2 s. c o m*/ startActivityForResultSafely(intent, REQUEST_CREATE_SHORTCUT); } }
From source file:com.android.gallery3d.app.PhotoPage.java
public void playVideo(Activity activity, Uri uri, String title) { try {//from w ww . j a v a 2 s . co m Intent intent = new Intent(Intent.ACTION_VIEW).setDataAndType(uri, "video/*") .putExtra(Intent.EXTRA_TITLE, title).putExtra(MovieActivity.KEY_TREAT_UP_AS_BACK, true) /// M: [BUG.ADD] @{ .putExtra(MovieActivity.KEY_COME_FROM_CAMERA, mAppBridge != null); intent.putExtra(FeatureHelper.EXTRA_ENABLE_VIDEO_LIST, true); /// @} activity.startActivityForResult(intent, REQUEST_PLAY_VIDEO); } catch (ActivityNotFoundException e) { Toast.makeText(activity, activity.getString(R.string.video_err), Toast.LENGTH_SHORT).show(); } }
From source file:es.javocsoft.android.lib.toolbox.ToolBox.java
/** * Allows to create a share intent and it can be launched. * /*w ww. j a v a 2 s . c o m*/ * @param context * @param type Mime type. * @param nameApp You can filter the application you want to share with. Use "wha", "twitt", etc. * @param title The title of the share.Take in account that sometimes is not possible to add the title. * @param data The data, can be a file or a text. * @param isBinaryData If the share has a data file, set to TRUE otherwise FALSE. */ @SuppressLint("DefaultLocale") public static Intent share_newSharingIntent(Context context, String type, String nameApp, String title, String data, boolean isBinaryData, boolean launch) { Intent res = null; Intent share = new Intent(Intent.ACTION_SEND); share.setType(type); List<Intent> targetedShareIntents = new ArrayList<Intent>(); List<ResolveInfo> resInfo = context.getPackageManager().queryIntentActivities(share, 0); if (!resInfo.isEmpty()) { for (ResolveInfo info : resInfo) { Intent targetedShare = new Intent(Intent.ACTION_SEND); targetedShare.setType(type); if (title != null) { targetedShare.putExtra(Intent.EXTRA_SUBJECT, title); targetedShare.putExtra(Intent.EXTRA_TITLE, title); if (data != null && !isBinaryData) { targetedShare.putExtra(Intent.EXTRA_TEXT, data); } } if (data != null && isBinaryData) { targetedShare.putExtra(Intent.EXTRA_TEXT, title); targetedShare.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(data))); } if (nameApp != null) { if (info.activityInfo.packageName.toLowerCase().contains(nameApp) || info.activityInfo.name.toLowerCase().contains(nameApp)) { targetedShare.setPackage(info.activityInfo.packageName); targetedShareIntents.add(targetedShare); } } else { targetedShare.setPackage(info.activityInfo.packageName); targetedShareIntents.add(targetedShare); } } Intent chooserIntent = Intent.createChooser(targetedShareIntents.remove(0), "Select app to share"); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShareIntents.toArray(new Parcelable[] {})); res = chooserIntent; if (launch) { context.startActivity(chooserIntent); } } return res; }
From source file:com.cognizant.trumobi.PersonaLauncher.java
void processShortcut(Intent intent, int requestCodeApplication, int requestCodeShortcut) { PersonaLog.e(LOG_TAG, "processShortcut" + intent); // Handle case where user selected "Applications" String applicationName = getResources().getString(R.string.group_applications); String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); if (applicationName != null && applicationName.equals(shortcutName)) { Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); // 290778 modified for shortcut /*//from ww w . j a va2 s . c om * Intent mainIntent = new Intent("Email"); * mainIntent.addCategory("android.intent.category.PIM"); */ Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY); pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent); pickIntent.putExtra(Intent.EXTRA_TITLE, getString(R.string.group_applications)); startActivityForResult(pickIntent, requestCodeApplication); } else { startActivityForResult(intent, requestCodeShortcut); } }
From source file:com.android.soma.Launcher.java
void processShortcut(Intent intent) { // Handle case where user selected "Applications" String applicationName = getResources().getString(R.string.group_applications); String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); if (applicationName != null && applicationName.equals(shortcutName)) { Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY); pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent); pickIntent.putExtra(Intent.EXTRA_TITLE, getText(R.string.title_select_application)); Utilities.startActivityForResultSafely(this, pickIntent, REQUEST_PICK_APPLICATION); } else {/*from ww w .j av a2 s.com*/ Utilities.startActivityForResultSafely(this, intent, REQUEST_CREATE_SHORTCUT); } }
From source file:com.mobiletin.inputmethod.indic.LatinIME.java
private void showSubtypeSelectorAndSettings() { final CharSequence title = getString(R.string.english_ime_input_options); // TODO: Should use new string "Select active input modes". final CharSequence languageSelectionTitle = getString(R.string.language_selection_title); final CharSequence[] items = new CharSequence[] { languageSelectionTitle, getString(ApplicationUtils.getActivityTitleResId(this, SettingsActivity.class)) }; final OnClickListener listener = new OnClickListener() { @Override// w w w . j av a 2s . com public void onClick(DialogInterface di, int position) { di.dismiss(); switch (position) { case 0: final Intent intent = IntentUtils.getInputLanguageSelectionIntent( mRichImm.getInputMethodIdOfThisIme(), Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(Intent.EXTRA_TITLE, languageSelectionTitle); startActivity(intent); break; case 1: launchSettings(); break; } } }; final AlertDialog.Builder builder = new AlertDialog.Builder( DialogUtils.getPlatformDialogThemeContext(this)); builder.setItems(items, listener).setTitle(title); final AlertDialog dialog = builder.create(); dialog.setCancelable(true /* cancelable */); dialog.setCanceledOnTouchOutside(true /* cancelable */); showOptionDialog(dialog); }
From source file:com.cognizant.trumobi.PersonaLauncher.java
private void pickShortcut(int requestCode, int title) { Bundle bundle = new Bundle(); /*/*w w w . j a va 2 s . co m*/ ArrayList<String> shortcutNames = new ArrayList<String>(); shortcutNames.add(getString(R.string.group_applications)); bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME, shortcutNames); ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>(); shortcutIcons.add(ShortcutIconResource.fromContext( PersonaLauncher.this, R.drawable.pr_ic_launcher_application)); bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, shortcutIcons);*/ // Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY); Intent pickIntent = new Intent(); String ShortCutName = new String(getString(R.string.group_applications)); bundle.putString(Intent.EXTRA_SHORTCUT_NAME, ShortCutName); pickIntent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_CREATE_SHORTCUT)); pickIntent.putExtra(Intent.EXTRA_TITLE, getString(R.string.group_applications)); pickIntent.putExtras(bundle); processShortcut(pickIntent, REQUEST_PICK_APPLICATION, REQUEST_CREATE_SHORTCUT); //startActivityForResult(pickIntent, requestCode); }
From source file:org.mozilla.gecko.BrowserApp.java
@Override public boolean onPrepareOptionsMenu(Menu aMenu) { if (aMenu == null) return false; // Hide the tab history panel when hardware menu button is pressed. TabHistoryFragment frag = (TabHistoryFragment) getSupportFragmentManager() .findFragmentByTag(TAB_HISTORY_FRAGMENT_TAG); if (frag != null) { frag.dismiss();/*from w w w .j a va 2 s.c o m*/ } if (!GeckoThread.checkLaunchState(GeckoThread.LaunchState.GeckoRunning)) { aMenu.findItem(R.id.settings).setEnabled(false); aMenu.findItem(R.id.help).setEnabled(false); } Tab tab = Tabs.getInstance().getSelectedTab(); final MenuItem bookmark = aMenu.findItem(R.id.bookmark); final MenuItem reader = aMenu.findItem(R.id.reading_list); final MenuItem back = aMenu.findItem(R.id.back); final MenuItem forward = aMenu.findItem(R.id.forward); final MenuItem share = aMenu.findItem(R.id.share); final MenuItem quickShare = aMenu.findItem(R.id.quickshare); final MenuItem saveAsPDF = aMenu.findItem(R.id.save_as_pdf); final MenuItem charEncoding = aMenu.findItem(R.id.char_encoding); final MenuItem findInPage = aMenu.findItem(R.id.find_in_page); final MenuItem desktopMode = aMenu.findItem(R.id.desktop_mode); final MenuItem enterGuestMode = aMenu.findItem(R.id.new_guest_session); final MenuItem exitGuestMode = aMenu.findItem(R.id.exit_guest_session); // Only show the "Quit" menu item on pre-ICS, television devices, // or if the user has explicitly enabled the clear on shutdown pref. // (We check the pref last to save the pref read.) // In ICS+, it's easy to kill an app through the task switcher. final boolean visible = Versions.preICS || HardwareUtils.isTelevision() || !PrefUtils .getStringSet(GeckoSharedPrefs.forProfile(this), ClearOnShutdownPref.PREF, new HashSet<String>()) .isEmpty(); aMenu.findItem(R.id.quit).setVisible(visible); aMenu.findItem(R.id.logins).setVisible(AppConstants.NIGHTLY_BUILD); if (tab == null || tab.getURL() == null) { bookmark.setEnabled(false); reader.setEnabled(false); back.setEnabled(false); forward.setEnabled(false); share.setEnabled(false); quickShare.setEnabled(false); saveAsPDF.setEnabled(false); findInPage.setEnabled(false); // NOTE: Use MenuUtils.safeSetEnabled because some actions might // be on the BrowserToolbar context menu. if (Versions.feature11Plus) { // There is no page menu prior to v11 resources. MenuUtils.safeSetEnabled(aMenu, R.id.page, false); } MenuUtils.safeSetEnabled(aMenu, R.id.subscribe, false); MenuUtils.safeSetEnabled(aMenu, R.id.add_search_engine, false); MenuUtils.safeSetEnabled(aMenu, R.id.site_settings, false); MenuUtils.safeSetEnabled(aMenu, R.id.add_to_launcher, false); return true; } final boolean inGuestMode = GeckoProfile.get(this).inGuestMode(); final boolean isAboutReader = AboutPages.isAboutReader(tab.getURL()); bookmark.setEnabled(!isAboutReader); bookmark.setVisible(!inGuestMode); bookmark.setCheckable(true); bookmark.setChecked(tab.isBookmark()); bookmark.setIcon(resolveBookmarkIconID(tab.isBookmark())); bookmark.setTitle(resolveBookmarkTitleID(tab.isBookmark())); reader.setEnabled(isAboutReader || !AboutPages.isAboutPage(tab.getURL())); reader.setVisible(!inGuestMode); reader.setCheckable(true); final boolean isPageInReadingList = tab.isInReadingList(); reader.setChecked(isPageInReadingList); reader.setIcon(resolveReadingListIconID(isPageInReadingList)); reader.setTitle(resolveReadingListTitleID(isPageInReadingList)); back.setEnabled(tab.canDoBack()); forward.setEnabled(tab.canDoForward()); desktopMode.setChecked(tab.getDesktopMode()); desktopMode.setIcon( tab.getDesktopMode() ? R.drawable.ic_menu_desktop_mode_on : R.drawable.ic_menu_desktop_mode_off); View backButtonView = MenuItemCompat.getActionView(back); if (backButtonView != null) { backButtonView.setOnLongClickListener(new Button.OnLongClickListener() { @Override public boolean onLongClick(View view) { Tab tab = Tabs.getInstance().getSelectedTab(); if (tab != null) { closeOptionsMenu(); return tabHistoryController.showTabHistory(tab, TabHistoryController.HistoryAction.BACK); } return false; } }); } View forwardButtonView = MenuItemCompat.getActionView(forward); if (forwardButtonView != null) { forwardButtonView.setOnLongClickListener(new Button.OnLongClickListener() { @Override public boolean onLongClick(View view) { Tab tab = Tabs.getInstance().getSelectedTab(); if (tab != null) { closeOptionsMenu(); return tabHistoryController.showTabHistory(tab, TabHistoryController.HistoryAction.FORWARD); } return false; } }); } String url = tab.getURL(); if (AboutPages.isAboutReader(url)) { String urlFromReader = ReaderModeUtils.getUrlFromAboutReader(url); if (urlFromReader != null) { url = urlFromReader; } } // Disable share menuitem for about:, chrome:, file:, and resource: URIs final boolean shareVisible = RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_SHARE); share.setVisible(shareVisible); final boolean shareEnabled = StringUtils.isShareableUrl(url) && shareVisible; share.setEnabled(shareEnabled); MenuUtils.safeSetEnabled(aMenu, R.id.downloads, RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_DOWNLOADS)); // NOTE: Use MenuUtils.safeSetEnabled because some actions might // be on the BrowserToolbar context menu. if (Versions.feature11Plus) { MenuUtils.safeSetEnabled(aMenu, R.id.page, !isAboutHome(tab)); } MenuUtils.safeSetEnabled(aMenu, R.id.subscribe, tab.hasFeeds()); MenuUtils.safeSetEnabled(aMenu, R.id.add_search_engine, tab.hasOpenSearch()); MenuUtils.safeSetEnabled(aMenu, R.id.site_settings, !isAboutHome(tab)); MenuUtils.safeSetEnabled(aMenu, R.id.add_to_launcher, !isAboutHome(tab)); // Action providers are available only ICS+. if (Versions.feature14Plus) { quickShare.setVisible(shareVisible); quickShare.setEnabled(shareEnabled); // This provider also applies to the quick share menu item. final GeckoActionProvider provider = ((GeckoMenuItem) share).getGeckoActionProvider(); if (provider != null) { Intent shareIntent = provider.getIntent(); // For efficiency, the provider's intent is only set once if (shareIntent == null) { shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); provider.setIntent(shareIntent); } // Replace the existing intent's extras shareIntent.putExtra(Intent.EXTRA_TEXT, url); shareIntent.putExtra(Intent.EXTRA_SUBJECT, tab.getDisplayTitle()); shareIntent.putExtra(Intent.EXTRA_TITLE, tab.getDisplayTitle()); shareIntent.putExtra(ShareDialog.INTENT_EXTRA_DEVICES_ONLY, true); // Clear the existing thumbnail extras so we don't share an old thumbnail. shareIntent.removeExtra("share_screenshot_uri"); // Include the thumbnail of the page being shared. BitmapDrawable drawable = tab.getThumbnail(); if (drawable != null) { Bitmap thumbnail = drawable.getBitmap(); // Kobo uses a custom intent extra for sharing thumbnails. if (Build.MANUFACTURER.equals("Kobo") && thumbnail != null) { File cacheDir = getExternalCacheDir(); if (cacheDir != null) { File outFile = new File(cacheDir, "thumbnail.png"); try { java.io.FileOutputStream out = new java.io.FileOutputStream(outFile); thumbnail.compress(Bitmap.CompressFormat.PNG, 90, out); } catch (FileNotFoundException e) { Log.e(LOGTAG, "File not found", e); } shareIntent.putExtra("share_screenshot_uri", Uri.parse(outFile.getPath())); } } } } } final boolean privateTabVisible = RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_PRIVATE_BROWSING); MenuUtils.safeSetVisible(aMenu, R.id.new_private_tab, privateTabVisible); // Disable save as PDF for about:home and xul pages. saveAsPDF.setEnabled(!(isAboutHome(tab) || tab.getContentType().equals("application/vnd.mozilla.xul+xml") || tab.getContentType().startsWith("video/"))); // Disable find in page for about:home, since it won't work on Java content. findInPage.setEnabled(!isAboutHome(tab)); charEncoding.setVisible(GeckoPreferences.getCharEncodingState()); if (mProfile.inGuestMode()) { exitGuestMode.setVisible(true); } else { enterGuestMode.setVisible(true); } if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_GUEST_BROWSING)) { MenuUtils.safeSetVisible(aMenu, R.id.new_guest_session, false); } if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_INSTALL_EXTENSION)) { MenuUtils.safeSetVisible(aMenu, R.id.addons, false); } return true; }