List of usage examples for android.content Intent FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET
To view the source code for android.content Intent FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET.
Click Source Link
From source file:org.familab.app.supportfiles.IntentIntegrator.java
/** * Initiates a scan only for a certain set of barcode types, given as strings corresponding * to their names in ZXing's {@code BarcodeFormat} class like "UPC_A". You can supply constants * like {@link #PRODUCT_CODE_TYPES} for example. * * @return the {@link android.app.AlertDialog} that was shown to the user prompting them to download the app * if a prompt was needed, or null otherwise *//* w w w.j av a 2s.c o m*/ public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats) { Intent intentScan = new Intent(BS_PACKAGE + ".SCAN"); intentScan.addCategory(Intent.CATEGORY_DEFAULT); // check which types of codes to scan for if (desiredBarcodeFormats != null) { // set the desired barcode types StringBuilder joinedByComma = new StringBuilder(); for (String format : desiredBarcodeFormats) { if (joinedByComma.length() > 0) { joinedByComma.append(','); } joinedByComma.append(format); } intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString()); } String targetAppPackage = findTargetAppPackage(intentScan); if (targetAppPackage == null) { return showDownloadDialog(); } intentScan.setPackage(targetAppPackage); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); attachMoreExtras(intentScan); startActivityForResult(intentScan, REQUEST_CODE); return null; }
From source file:potboiler.client.PotsActivity.java
License:asdf
private void shareTextUrl() { Intent share = new Intent(android.content.Intent.ACTION_SEND); share.setType("text/plain"); share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); // Add data to the intent, the receiving app will decide // what to do with it. share.putExtra(Intent.EXTRA_SUBJECT, "Potboiler"); share.putExtra(Intent.EXTRA_TEXT,/*from w w w .j a v a 2s .c o m*/ "? ?? Potboiler https://play.google.com/store/apps/details?id=potboiler.client"); startActivity(Intent.createChooser(share, "?? ?")); }
From source file:com.sudhirkhanger.app.popularmovies.DetailFragment.java
private Intent createShareForecastIntent() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); shareIntent.setType("text/plain"); if (mTrailerArrayList != null) { shareIntent.putExtra(Intent.EXTRA_TEXT, YT_SHARE + mTrailerArrayList.get(FIRST_TRAILER_POS).getLink()); } else {// w ww . j av a2 s. c o m shareIntent.putExtra(Intent.EXTRA_TEXT, YT_NO_SHARE); } return shareIntent; }
From source file:com.battlelancer.seriesguide.ui.TraktShoutsFragment.java
public void onListItemClick(ListView l, View v, int position, long id) { final Comment comment = (Comment) l.getItemAtPosition(position); if (comment == null) { return;/*from w ww . j a v a 2 s . c o m*/ } if (comment.spoiler) { // if shout is a spoiler, first click will reveal the shout comment.spoiler = false; TextView shoutText = (TextView) v.findViewById(R.id.shout); if (shoutText != null) { shoutText.setText(comment.text); } } else { // open shout or review page int showTvdbId = getArguments().getInt(InitBundle.SHOW_TVDB_ID); int episodeNumber = getArguments().getInt(InitBundle.EPISODE_NUMBER); String typeUrl; if (showTvdbId == 0) { typeUrl = TRAKT_MOVIE_COMMENT_PAGE_URL; } else if (episodeNumber == 0) { typeUrl = TRAKT_SHOW_COMMENT_PAGE_URL; } else { typeUrl = TRAKT_EPISODE_COMMENT_PAGE_URL; } Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(typeUrl + comment.id)); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); Utils.tryStartActivity(getActivity(), intent, true); } }
From source file:com.example.android.foodrecipes.app.RecipeDetailsFragment.java
private Intent createShareRecipeIntent() { String shareText = getActivity().getString(R.string.recipe_share_text); String recipeShareString = String.format(shareText, mRecipe.getTitle(), mRecipe.getSourceUrl()) + RECIPE_SHARE_HASHTAG;/*from w ww. j a v a 2 s .com*/ Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_TEXT, recipeShareString); return shareIntent; }
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. ja v a 2 s . c om*/ 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:com.color.kid.kidpaint.activity.OptionsActivity.java
protected void takePhoto() { File tempFile = FileIO.createNewEmptyPictureFile(OptionsActivity.this, FileIO.getDefaultFileName()); if (tempFile != null) { mCameraImageUri = Uri.fromFile(tempFile); }//from ww w . j av a 2 s. c o m if (mCameraImageUri == null) { new InfoDialog(InfoDialog.DialogType.WARNING, R.string.dialog_error_sdcard_text, R.string.dialog_error_save_title).show(getSupportFragmentManager(), "savedialogerror"); return; } Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); intent.putExtra(MediaStore.EXTRA_OUTPUT, mCameraImageUri); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivityForResult(intent, REQUEST_CODE_TAKE_PICTURE); }
From source file:com.licubeclub.zionhs.MealActivity.java
private Intent createShareIntent(int pos) { //? ACTION_SEND . Intent shareIntent = new Intent(Intent.ACTION_SEND); //Flag ?. ? ? ? Activity , // ? ? Activity ? //FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET ?. shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); // ? . ? ./*from w ww .j a va 2s . c o m*/ shareIntent.setType("text/plain"); String mealData; try { mealData = getResources().getString(R.string.lunch) + "\n" + LunchArray[mViewPager.getCurrentItem() + 1] + "\n\n" + getResources().getString(R.string.dinner) + "\n" + DinnerArray[mViewPager.getCurrentItem() + 1] + "\n\n"; } catch (Exception e) { mealData = getResources().getString(R.string.nodata); } // ?? Extra ?. shareIntent.putExtra(Intent.EXTRA_TEXT, mealData); Log.d(LOG_TAG, "Creating Share Intent:" + mealData); return shareIntent; }
From source file:Utils.GenericUtils.java
public final AlertDialog initiateScan(FragmentActivity fa, Collection<String> desiredBarcodeFormats) { Intent intentScan = new Intent("com.google.zxing.client.android.SCAN"); intentScan.addCategory(Intent.CATEGORY_DEFAULT); intentScan.putExtra("SCAN_FORMATS", "QR_CODE_MODE"); fa.startActivityForResult(intentScan, 312 /*IntentIntegrator.REQUEST_CODE*/); String targetAppPackage = "ET - QRCODE SCANNER"; intentScan.setPackage(targetAppPackage); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); return null;// w w w .j av a 2 s . co m }
From source file:com.android.mms.ui.MailBoxMessageContent.java
public void saveToContact() { String address = mMsgFrom;/*ww w.j av a2 s. c om*/ if (TextUtils.isEmpty(address)) { if (LogTag.VERBOSE || Log.isLoggable(LogTag.APP, Log.VERBOSE)) { Log.v(TAG, " saveToContact fail for null address! "); } return; } // address must be a single recipient Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.setType(Contacts.CONTENT_ITEM_TYPE); if (Mms.isEmailAddress(address)) { intent.putExtra(ContactsContract.Intents.Insert.EMAIL, address); } else { intent.putExtra(ContactsContract.Intents.Insert.PHONE, address); intent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE); } intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); this.startActivity(intent); }