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.android.mms.rcs.FavoriteDetailActivity.java
public void saveToContact() { String address = mMsgFrom;/*from www . ja v a2 s. co m*/ 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); 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); }
From source file:com.meiste.greg.ptw.tab.Standings.java
@Override public void onClick(final DialogInterface dialog, final int which) { if (which != DialogInterface.BUTTON_POSITIVE) { // Nothing to do return;/*from w ww.j a v a 2s . c o m*/ } if (ActivityManager.isUserAMonkey()) { Util.log("Standings: onClick: User is a monkey!"); return; } if (dialog == mPrivacyDialog) { final String json = new Gson().toJson(mPrivacyDialog.getNewName()); mConnecting = mChanged = true; notifyChanged(); GAE.getInstance(getActivity()).postPage(this, "standings", json); } else if (dialog == mFriendActionDialog) { Util.log("Toggling " + mFriendActionDialog.getPlayer().getName() + " friend status"); final FriendRequest fReq = new FriendRequest(mFriendActionDialog.getPlayer()); fReq.player.friend = !fReq.player.friend; mConnecting = mChanged = true; notifyChanged(); GAE.getInstance(getActivity()).postPage(mFriendListener, "friend", fReq.toJson()); } else if (dialog == mFriendPlayerDialog) { Util.log("Requesting to add " + mFriendPlayerDialog.getPlayerName() + " as friend"); final FriendRequest fReq = new FriendRequest(new Player()); fReq.player.name = mFriendPlayerDialog.getPlayerName(); fReq.player.friend = true; mConnecting = mChanged = true; notifyChanged(); GAE.getInstance(getActivity()).postPage(mFriendListener, "friend", fReq.toJson()); } else if (dialog == mFriendMethodDialog) { switch (mFriendMethodDialog.getSelectedMethod()) { case FriendMethodDialog.METHOD_MANUAL: Util.log("Adding friend via username"); showFriendPlayerDialog(); break; case FriendMethodDialog.METHOD_NFC: Util.log("Adding friend using NFC"); final FriendRequest fReq = new FriendRequest(mAdapter.getPlayer(), Gcm.getRegistrationId(getActivity().getApplicationContext())); final Intent intent = new Intent(getActivity(), NfcSendActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(NfcSendActivity.EXTRA_PLAYER_REQ, fReq.toJson()); startActivity(intent); break; } } }
From source file:android.support.v7.widget.ShareActionProvider.java
private void updateIntent(Intent intent) { if (Build.VERSION.SDK_INT >= 21) { // If we're on Lollipop, we can open the intent as a document intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); } else {//from ww w . jav a2 s . c o m // Else, we will use the old CLEAR_WHEN_TASK_RESET flag intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); } }
From source file:com.nkahoang.screenstandby.Main.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_toggle: { Intent intentToggle = new Intent("com.nkahoang.screenstandby.action.TOGGLE"); Main.this.sendBroadcast(intentToggle); break;//from ww w . j a va 2 s.co m } case R.id.menu_exit: { this.finish(); break; } case R.id.menu_debuginfo: Logger.ShowLog(Main.this); break; case R.id.menu_rate: Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.nkahoang.screenstandby")); marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(marketIntent); break; case R.id.menu_watch_youtube: openVideoClip(); break; case R.id.menu_troubleshooting: Intent intentTroubleshooting = new Intent(Main.this, TroubleshootingActivity.class); startActivity(intentTroubleshooting); break; case R.id.menu_manual: Intent intentManual = new Intent(Main.this, ManualBrightnessChangerActivity.class); startActivity(intentManual); break; case R.id.menu_setting: openSettings(); break; case R.id.menu_devmessage: ChangeLogHandler.ShowChangelog(this); break; /* case R.id.menu_changedpi: Intent dpiintent = new Intent(Main.this, XTopDPIChanger.class); startActivity(dpiintent); break;*/ } return true; }
From source file:org.familab.app.supportfiles.IntentIntegrator.java
/** * Shares the given text by encoding it as a barcode, such that another user can * scan the text off the screen of the device. * * @param text the text string to encode as a barcode * @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants. * @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 *///from w w w . j av a 2 s . c om public final AlertDialog shareText(CharSequence text, CharSequence type) { Intent intent = new Intent(); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setAction(BS_PACKAGE + ".ENCODE"); intent.putExtra("ENCODE_TYPE", type); intent.putExtra("ENCODE_DATA", text); String targetAppPackage = findTargetAppPackage(intent); if (targetAppPackage == null) { return showDownloadDialog(); } intent.setPackage(targetAppPackage); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); attachMoreExtras(intent); activity.startActivity(intent); return null; }
From source file:com.razza.apps.iosched.videolibrary.VideoLibraryFilteredFragment.java
@Override public void bindCollectionItemView(Context context, View view, int groupId, int indexInGroup, int dataIndex, Object tag) {/*ww w . java 2 s . co m*/ final VideoLibraryModel.Video video = (VideoLibraryModel.Video) tag; if (video == null) { return; } ImageView thumbnailView = (ImageView) view.findViewById(R.id.thumbnail); TextView titleView = (TextView) view.findViewById(R.id.title); TextView speakersView = (TextView) view.findViewById(R.id.speakers); TextView descriptionView = (TextView) view.findViewById(R.id.description); titleView.setText(video.getTitle()); speakersView.setText(video.getSpeakers()); speakersView.setVisibility(TextUtils.isEmpty(video.getSpeakers()) ? View.GONE : View.VISIBLE); descriptionView.setText(video.getDesc()); descriptionView.setVisibility( TextUtils.isEmpty(video.getDesc()) || video.getTitle().equals(video.getDesc()) ? View.GONE : View.VISIBLE); String thumbUrl = video.getThumbnailUrl(); if (TextUtils.isEmpty(thumbUrl)) { thumbnailView.setImageResource(android.R.color.transparent); } else { mImageLoader.loadImage(thumbUrl, thumbnailView); } // Display the overlay if the video has already been played. if (video.getAlreadyPlayed()) { styleVideoAsViewed(view); } final String videoId = video.getId(); final String youtubeLink = TextUtils.isEmpty(videoId) ? "" : videoId.contains("://") ? videoId : String.format(Locale.US, Config.VIDEO_LIBRARY_URL_FMT, videoId); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!TextUtils.isEmpty(youtubeLink)) { LogUtils.LOGD(TAG, "Launching Youtube video: " + youtubeLink); // ANALYTICS EVENT: Click on a video on the Filtered Video Library screen // Contains: video's YouTube URL, http://www.youtube.com/... AnalyticsHelper.sendEvent(FILTERED_VIDEO_LIBRARY_ANALYTICS_CATEGORY, "selectvideo", youtubeLink); Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(youtubeLink)); UIUtils.preferPackageForIntent(getActivity(), i, UIUtils.YOUTUBE_PACKAGE_NAME); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(i); // Mark the video as played. fireVideoPlayedEvent(video); // Display the overlay for videos that has already been played. styleVideoAsViewed(view); } } }); }
From source file:com.google.samples.apps.iosched.videolibrary.VideoLibraryFilteredFragment.java
@Override public void bindCollectionItemView(Context context, View view, int groupId, int indexInGroup, int dataIndex, Object tag) {/*from w w w .j av a2 s .c o m*/ final VideoLibraryModel.Video video = (VideoLibraryModel.Video) tag; if (video == null) { return; } ImageView thumbnailView = (ImageView) view.findViewById(R.id.thumbnail); TextView titleView = (TextView) view.findViewById(R.id.title); TextView speakersView = (TextView) view.findViewById(R.id.speakers); TextView descriptionView = (TextView) view.findViewById(R.id.description); titleView.setText(video.getTitle()); speakersView.setText(video.getSpeakers()); speakersView.setVisibility(TextUtils.isEmpty(video.getSpeakers()) ? View.GONE : View.VISIBLE); descriptionView.setText(video.getDesc()); descriptionView.setVisibility( TextUtils.isEmpty(video.getDesc()) || video.getTitle().equals(video.getDesc()) ? View.GONE : View.VISIBLE); String thumbUrl = video.getThumbnailUrl(); if (TextUtils.isEmpty(thumbUrl)) { thumbnailView.setImageResource(android.R.color.transparent); } else { mImageLoader.loadImage(thumbUrl, thumbnailView); } // Display the overlay if the video has already been played. if (video.getAlreadyPlayed()) { styleVideoAsViewed(view); } final String videoId = video.getId(); final String youtubeLink = TextUtils.isEmpty(videoId) ? "" : videoId.contains("://") ? videoId : String.format(Locale.US, Config.VIDEO_LIBRARY_URL_FMT, videoId); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!TextUtils.isEmpty(youtubeLink)) { LOGD(TAG, "Launching Youtube video: " + youtubeLink); // ANALYTICS EVENT: Click on a video on the Filtered Video Library screen // Contains: video's YouTube URL, http://www.youtube.com/... AnalyticsHelper.sendEvent(FILTERED_VIDEO_LIBRARY_ANALYTICS_CATEGORY, "selectvideo", youtubeLink); Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(youtubeLink)); UIUtils.preferPackageForIntent(getActivity(), i, UIUtils.YOUTUBE_PACKAGE_NAME); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(i); // Mark the video as played. fireVideoPlayedEvent(video); // Display the overlay for videos that has already been played. styleVideoAsViewed(view); } } }); }
From source file:com.nikhilnayak.games.octoshootar.HomeActivity.java
@Override public void onShareScoreRequested(long score) { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.score_share_subject)); intent.putExtra(Intent.EXTRA_TEXT, getResources().getString(R.string.score_share_content, score)); startActivity(Intent.createChooser(intent, getResources().getString(R.string.score_share_dialog))); }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventsListFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.resolveall: { AckEventsHandler.sendEmptyMessage(ACKEVENTHANDLER_PROGRESS); final List<String> EventIDs = new ArrayList<String>(); if (null != listOfZenossEvents) { try { for (ZenossEvent evt : listOfZenossEvents) { if (!evt.getEventState().equals("Acknowledged")) { evt.setProgress(true); EventIDs.add(evt.getEVID()); }//from w w w . jav a2 s.com } } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventsListFragment", "resolveall", e); } } new Thread() { public void run() { try { if (null != mService && mBound) { try { if (null == mService.API) { mService.PrepAPI(true, true); } ZenossCredentials credentials = new ZenossCredentials(getActivity()); mService.API.Login(credentials); mService.API.AcknowledgeEvents(EventIDs); } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventsListFragment", "AckAllThread", e); } } else { if (null != AckEventsHandler) AckEventsHandler.sendEmptyMessage(ACKEVENTHANDLER_FAILURE); } //TODO Check it actually succeeded if (null != AckEventsHandler) AckEventsHandler.sendEmptyMessage(ACKEVENTHANDLER_SUCCESS); } catch (Exception e) { //e.printStackTrace(); if (null != AckEventsHandler) AckEventsHandler.sendEmptyMessage(ACKEVENTHANDLER_FAILURE); BugSenseHandler.sendExceptionMessage("ViewZenossEventsListFragment", "resolve all outer catch", e); } } }.start(); return true; } case R.id.refresh: { Refresh(); return true; } 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 Events"); String Events = ""; for (ZenossEvent evt : listOfZenossEvents) { Events += evt.getDevice() + " - " + evt.getSummary() + "\r\n\r\n"; } intent.putExtra(Intent.EXTRA_TEXT, Events); startActivity(Intent.createChooser(intent, "How would you like to escalate these events?")); } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventsListFragment", "escalate", e); } } } return false; }
From source file:com.example.julia.popularmovies.details.DetailFragment.java
private void setShareActionProvider(Trailer trailer) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); shareIntent.setType("text/plain"); shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mMovie.getTitle()); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, trailer.getName() + ": " + trailer.getTrailerUrl()); if (mShareActionProvider != null) { mShareActionProvider.setShareIntent(shareIntent); }/*from w w w . java2 s . c om*/ }