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:com.stillnojetpacks.huffr.activities.MainActivity.java
@SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.LOLLIPOP) private Intent rateIntentForUrl(String url) { Intent intent = new Intent(Intent.ACTION_VIEW, uriForUrl(url)); int flags = Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { flags |= Intent.FLAG_ACTIVITY_NEW_DOCUMENT; } else {// ww w . j a v a 2 s. c om flags |= Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET; } intent.addFlags(flags); return intent; }
From source file:com.liwn.zzl.markbit.DrawOptionsMenuActivity.java
protected void takePhoto() { File tempFile = FileIO.createNewEmptyPictureFile(DrawOptionsMenuActivity.this, FileIO.getDefaultFileName()); if (tempFile != null) { mCameraImageUri = Uri.fromFile(tempFile); }// w w w. jav a2 s .com if (mCameraImageUri == null) { new 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 intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, mCameraImageUri); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivityForResult(intent, REQUEST_CODE_TAKE_PICTURE); // 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.example.droidcodin.popularmdb.MovieDetailFragment.java
private Intent createMovieShareIntent() { 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, mMovieStr + MOVIESHARE_HASHTAG); return shareIntent; }
From source file:com.denel.facepatrol.MainActivity.java
public void ContactEdit(View view) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Contact Information Feedback") .setMessage("You're about to edit and send personal information. " + "Please note that the current database will only reflect your modification" + " once the IT department verifies the change and the updated database" + " is synced to your device. \n \n Do you want to continue?") .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Intent emailIntent = new Intent(Intent.ACTION_SENDTO); emailIntent.setData(Uri.parse("mailto:")); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "pkantue@gmail.com" }); // this email address will change emailIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); emailIntent.putExtra(Intent.EXTRA_SUBJECT, feedback_subject); emailIntent.putExtra(Intent.EXTRA_TEXT, feedback_body); startActivity(Intent.createChooser(emailIntent, "Send Email...")); }/*from w ww . ja v a2 s. c om*/ }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); builder.show(); // exit the application //finish(); }
From source file:com.nkahoang.screenstandby.Main.java
private void openVideoClip() { Builder watchDialog = new AlertDialog.Builder(this).setCancelable(true); watchDialog.setTitle("Select a video clip:"); watchDialog.setIcon(android.R.drawable.ic_menu_slideshow); watchDialog.setItems(clipsName, new android.content.DialogInterface.OnClickListener() { @Override/*ww w . ja va 2 s.c o m*/ public void onClick(DialogInterface dialog, int which) { if (which >= 0) { Intent youtubeIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + clipsUrl[which])); youtubeIntent .addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(youtubeIntent); } } }); watchDialog.setNegativeButton("Dismiss", null); watchDialog.show(); }
From source file:com.androidinspain.deskclock.stopwatch.StopwatchFragment.java
/** * Send stopwatch time and lap times to an external sharing application. *//*from www . j a v a2 s . c o m*/ private void doShare() { // Disable the fab buttons to avoid double-taps on the share button. updateFab(BUTTONS_DISABLE); final String[] subjects = getResources().getStringArray(R.array.sw_share_strings); final String subject = subjects[(int) (Math.random() * subjects.length)]; final String text = mLapsAdapter.getShareText(); @SuppressLint("InlinedApi") @SuppressWarnings("deprecation") final Intent shareIntent = new Intent(Intent.ACTION_SEND) .addFlags(Utils.isLOrLater() ? Intent.FLAG_ACTIVITY_NEW_DOCUMENT : Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) .putExtra(Intent.EXTRA_SUBJECT, subject).putExtra(Intent.EXTRA_TEXT, text).setType("text/plain"); final Context context = getActivity(); final String title = context.getString(R.string.sw_share_button); final Intent shareChooserIntent = Intent.createChooser(shareIntent, title); try { context.startActivity(shareChooserIntent); } catch (ActivityNotFoundException anfe) { LogUtils.e("Cannot share lap data because no suitable receiving Activity exists"); updateFab(BUTTONS_IMMEDIATE); } }
From source file:net.abcdroid.devfest12.ui.SessionDetailFragment.java
/** * Handle {@link SessionsQuery} {@link Cursor}. *///from ww w. j a v a 2 s. c o m private void onSessionQueryComplete(Cursor cursor) { mSessionCursor = true; if (!cursor.moveToFirst()) { return; } mTitleString = cursor.getString(SessionsQuery.TITLE); // Format time block this session occupies mSessionBlockStart = cursor.getLong(SessionsQuery.BLOCK_START); mSessionBlockEnd = cursor.getLong(SessionsQuery.BLOCK_END); mRoomName = cursor.getString(SessionsQuery.ROOM_NAME); final String subtitle = UIUtils.formatSessionSubtitle(mTitleString, mSessionBlockStart, mSessionBlockEnd, mRoomName, getActivity()); mTitle.setText(mTitleString); mUrl = cursor.getString(SessionsQuery.URL); if (TextUtils.isEmpty(mUrl)) { mUrl = ""; } mHashtags = cursor.getString(SessionsQuery.HASHTAGS); if (!TextUtils.isEmpty(mHashtags)) { enableSocialStreamMenuItemDeferred(); } mRoomId = cursor.getString(SessionsQuery.ROOM_ID); setupShareMenuItemDeferred(); showStarredDeferred(mInitStarred = (cursor.getInt(SessionsQuery.STARRED) != 0)); final String sessionAbstract = cursor.getString(SessionsQuery.ABSTRACT); if (!TextUtils.isEmpty(sessionAbstract)) { UIUtils.setTextMaybeHtml(mAbstract, sessionAbstract); mAbstract.setVisibility(View.VISIBLE); mHasSummaryContent = true; } else { mAbstract.setVisibility(View.GONE); } mPlusOneButton.setSize(PlusOneButton.Size.TALL); String url = cursor.getString(SessionsQuery.URL); if (TextUtils.isEmpty(url)) { mPlusOneButton.setVisibility(View.GONE); } else { mPlusOneButton.setUrl(url); } final View requirementsBlock = mRootView.findViewById(R.id.session_requirements_block); final String sessionRequirements = cursor.getString(SessionsQuery.REQUIREMENTS); if (!TextUtils.isEmpty(sessionRequirements)) { UIUtils.setTextMaybeHtml(mRequirements, sessionRequirements); requirementsBlock.setVisibility(View.VISIBLE); mHasSummaryContent = true; } else { requirementsBlock.setVisibility(View.GONE); } // Show empty message when all data is loaded, and nothing to show if (mSpeakersCursor && !mHasSummaryContent) { mRootView.findViewById(android.R.id.empty).setVisibility(View.VISIBLE); } ViewGroup linksContainer = (ViewGroup) mRootView.findViewById(R.id.links_container); linksContainer.removeAllViews(); LayoutInflater inflater = getLayoutInflater(null); boolean hasLinks = false; final Context context = mRootView.getContext(); // Render I/O live link final boolean hasLivestream = !TextUtils.isEmpty(cursor.getString(SessionsQuery.LIVESTREAM_URL)); long currentTimeMillis = UIUtils.getCurrentTime(context); if (UIUtils.hasHoneycomb() // Needs Honeycomb+ for the live stream && hasLivestream && currentTimeMillis > mSessionBlockStart && currentTimeMillis <= mSessionBlockEnd) { hasLinks = true; // Create the link item ViewGroup linkContainer = (ViewGroup) inflater.inflate(R.layout.list_item_session_link, linksContainer, false); ((TextView) linkContainer.findViewById(R.id.link_text)).setText(R.string.session_link_livestream); linkContainer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fireLinkEvent(R.string.session_link_livestream); Intent livestreamIntent = new Intent(Intent.ACTION_VIEW, mSessionUri); livestreamIntent.setClass(context, SessionLivestreamActivity.class); startActivity(livestreamIntent); } }); linksContainer.addView(linkContainer); } // Render normal links for (int i = 0; i < SessionsQuery.LINKS_INDICES.length; i++) { final String linkUrl = cursor.getString(SessionsQuery.LINKS_INDICES[i]); if (!TextUtils.isEmpty(linkUrl)) { hasLinks = true; // Create the link item ViewGroup linkContainer = (ViewGroup) inflater.inflate(R.layout.list_item_session_link, linksContainer, false); ((TextView) linkContainer.findViewById(R.id.link_text)).setText(SessionsQuery.LINKS_TITLES[i]); final int linkTitleIndex = i; linkContainer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { fireLinkEvent(SessionsQuery.LINKS_TITLES[linkTitleIndex]); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(linkUrl)); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); UIUtils.safeOpenLink(context, intent); } }); linksContainer.addView(linkContainer); } } // Show past/present/future and livestream status for this block. UIUtils.updateTimeAndLivestreamBlockUI(context, mSessionBlockStart, mSessionBlockEnd, hasLivestream, null, null, mSubtitle, subtitle); mRootView.findViewById(R.id.session_links_block).setVisibility(hasLinks ? View.VISIBLE : View.GONE); EasyTracker.getTracker().trackView("Session: " + mTitleString); LOGD("Tracker", "Session: " + mTitleString); }
From source file:com.wizardsofm.deskclock.stopwatch.StopwatchFragment.java
/** * Send stopwatch time and lap times to an external sharing application. *//* ww w .j a v a 2s. co m*/ private void doShare() { final String[] subjects = getResources().getStringArray(com.wizardsofm.deskclock.R.array.sw_share_strings); final String subject = subjects[(int) (Math.random() * subjects.length)]; final String text = mLapsAdapter.getShareText(); @SuppressLint("InlinedApi") @SuppressWarnings("deprecation") final Intent shareIntent = new Intent(Intent.ACTION_SEND) .addFlags(Utils.isLOrLater() ? Intent.FLAG_ACTIVITY_NEW_DOCUMENT : Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) .putExtra(Intent.EXTRA_SUBJECT, subject).putExtra(Intent.EXTRA_TEXT, text).setType("text/plain"); final Context context = getActivity(); final String title = context.getString(com.wizardsofm.deskclock.R.string.sw_share_button); final Intent shareChooserIntent = Intent.createChooser(shareIntent, title); try { context.startActivity(shareChooserIntent); } catch (ActivityNotFoundException anfe) { LogUtils.e("No compatible receiver is found"); } }
From source file:com.smp.musicspeed.MainActivity.java
private void startShare() { 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./*w w w .ja v a 2 s . co m*/ String fileName = null; if (service != null && service.getFileName() != null) { fileName = new File(service.getFileName()).getName(); } String music = fileName == null ? "music" : fileName; intent.putExtra(Intent.EXTRA_SUBJECT, "Music Speed Changer"); intent.putExtra(Intent.EXTRA_TEXT, "I'm listening to " + music + " at a different tempo and pitch with Music Speed Changer, available at Google Play: " + "https://play.google.com/store/apps/details?id=com.smp.musicspeed"); startActivity(Intent.createChooser(intent, "How do you want to share?")); }
From source file:io.github.hidroh.materialistic.AppUtils.java
@SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.LOLLIPOP) public static void openPlayStore(Context context) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(PLAY_STORE_URL)); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); } else {//from w w w. jav a2s. c o m intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); } try { context.startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(context, R.string.no_playstore, Toast.LENGTH_SHORT).show(); } }