Example usage for android.content Intent FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

List of usage examples for android.content Intent FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET

Introduction

In this page you can find the example usage for android.content Intent FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET.

Prototype

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

Usage

From source file:com.example.tony.popularmovie.DetailActivityFragment.java

private Intent createShareForecastIntent() {
    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, sMovieTitle + " trailer: " + BASE_YOUTUBE_URL + sKey);
    return shareIntent;
}

From source file:net.abcdroid.devfest12.ui.SocialStreamFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    Activity activity = mStream.get(position);

    Intent postDetailIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(activity.getUrl()));
    postDetailIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    UIUtils.preferPackageForIntent(getActivity(), postDetailIntent, UIUtils.GOOGLE_PLUS_PACKAGE_NAME);
    UIUtils.safeOpenLink(getActivity(), postDetailIntent);
}

From source file:com.gdgdevfest.android.apps.devfestbcn.ui.SocialStreamFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    Activity activity = mStream.get(position);

    Intent postDetailIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(activity.getUrl()));
    postDetailIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    UIUtils.preferPackageForIntent(getActivity(), postDetailIntent, UIUtils.GOOGLE_PLUS_PACKAGE_NAME);
    startActivity(postDetailIntent);/*from w ww . j a  v a  2 s . c  om*/
}

From source file:com.mediatek.mms.ext.DefaultMmsConfigExt.java

public void openUrl(Context context, String url) {
    Log.d(TAG, "openUrl, url=" + url);
    Uri theUri = Uri.parse(url);/*from   w w  w.j  a  va  2  s  .c o  m*/
    Intent intent = new Intent(Intent.ACTION_VIEW, theUri);
    intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    context.startActivity(intent);
}

From source file:eg.edu.alexu.alexandriauniversity.activity.ViewItemActivity.java

private Intent createShareIntent() {
    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, mAlexU + ALEXU_SHARE_HASHTAG);
    return shareIntent;
}

From source file:com.silentcircle.contacts.quickcontact.QuickContactActivity.java

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR1) {
        Log.i(TAG, "QuickContact only available for API >= HONEYCOMB_MR1");
        finish();/*from w  w  w  .j a v  a2  s .co  m*/
        return;
    }

    if (TRACE_LAUNCH)
        android.os.Debug.startMethodTracing(TRACE_TAG);

    // Parse intent
    final Intent intent = getIntent();

    Uri lookupUri = intent.getData();

    mLookupUri = Preconditions.checkNotNull(lookupUri, "missing lookupUri");

    mExcludeMimes = intent.getStringArrayExtra(QuickContact.EXTRA_EXCLUDE_MIMES);

    mContactLoader = (ContactLoader) getSupportLoaderManager().initLoader(LOADER_ID, null, mLoaderCallbacks);

    // Show QuickContact in front of soft input
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
            WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);

    setContentView(R.layout.quickcontact_activity);

    mFloatingLayout = (FloatingChildLayout) findViewById(R.id.floating_layout);
    mTrack = (ViewGroup) findViewById(R.id.track);
    mTrackScroller = (HorizontalScrollView) findViewById(R.id.track_scroller);
    mOpenDetailsImage = (ImageView) findViewById(R.id.contact_details_image);
    mOpenDetailsPushLayerButton = (ImageButton) findViewById(R.id.open_details_push_layer);
    mListPager = (ViewPager) findViewById(R.id.item_list_pager);
    mSelectedTabRectangle = findViewById(R.id.selected_tab_rectangle);
    mLineAfterTrack = findViewById(R.id.line_after_track);

    mFloatingLayout.setOnOutsideTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            handleOutsideTouch();
            return true;
        }
    });

    final OnClickListener openDetailsClickHandler = new OnClickListener() {
        @Override
        public void onClick(View v) {
            final Intent intent = new Intent(Intent.ACTION_VIEW, mLookupUri);
            mContactLoader.cacheResult();
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
            startActivity(intent);
            close(false);
        }
    };
    mOpenDetailsPushLayerButton.setOnClickListener(openDetailsClickHandler);
    mListPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager()));
    mListPager.setOnPageChangeListener(new PageChangeListener());

    final Rect sourceBounds = intent.getSourceBounds();
    if (sourceBounds != null) {
        mFloatingLayout.setChildTargetScreen(sourceBounds);
    }

    // find and prepare correct header view
    mPhotoContainer = findViewById(R.id.photo_container);
    setHeaderNameText(R.id.name, R.string.missing_name);

    SchedulingUtils.doAfterLayout(mFloatingLayout, new Runnable() {
        @Override
        public void run() {
            mFloatingLayout.fadeInBackground();
        }
    });
}

From source file:com.charabia.SmsViewActivity.java

public void buttonEdit(View view) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setClassName(this, CharabiaActivity.class.getName());
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    startActivity(intent);/*  w w w  .  ja  v  a  2 s.c om*/
}

From source file:com.android.mail.browse.AttachmentActionHandler.java

public void shareAttachments(ArrayList<Parcelable> uris) {
    Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
    intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);

    intent.setType("image/*");
    intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);

    try {//  w ww. j a v  a  2 s .co  m
        mContext.startActivity(intent);
    } catch (ActivityNotFoundException e) {
        // couldn't find activity for SEND_MULTIPLE intent
        LogUtils.e(LOG_TAG, "Couldn't find Activity for intent", e);
    }
}

From source file:com.glandorf1.joe.wsprnetviewer.app.DetailFragment.java

private Intent createShareWsprIntent() {
    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, mWspr + "\n" + WSPR_SHARE_HASHTAG);
    return shareIntent;
}

From source file:com.krayzk9s.imgurholo.ui.ImagesFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // handle item selection
    final Activity activity = getActivity();
    switch (item.getItemId()) {
    case R.id.action_download:
        Toast.makeText(activity,/*  w w  w. ja va  2 s  .  co m*/
                String.format(getActivity().getResources().getString(R.string.toast_downloading), urls.size()),
                Toast.LENGTH_SHORT).show();
        Intent serviceIntent = new Intent(activity, DownloadService.class);
        serviceIntent.putParcelableArrayListExtra("ids", ids);
        if (albumId != null)
            serviceIntent.putExtra("albumName", albumId);
        else
            serviceIntent.putExtra("albumName", imageCall);
        activity.startService(serviceIntent);
        return true;
    case R.id.action_refresh:
        urls = new ArrayList<String>();
        ids = new ArrayList<JSONParcelable>();
        page = 0;
        makeGallery();
        return true;
    case R.id.action_copy:
        ClipboardManager clipboard = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData clip = ClipData.newPlainText("imgur Link", "http://imgur.com/a/" + albumId);
        clipboard.setPrimaryClip(clip);
        Toast.makeText(activity, R.string.toast_copied, Toast.LENGTH_SHORT).show();
        return true;
    case R.id.action_share:
        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_TEXT, "http://imgur.com/a/" + albumId);
        startActivity(intent);
        return true;
    case R.id.action_new:
        Intent i = new Intent(this.getActivity().getApplicationContext(), ImageSelectActivity.class);
        startActivityForResult(i, 1);
        //select image
        return true;
    case R.id.action_comments:
        if (galleryAlbumData != null) {
            CommentsAsync commentsAsync = new CommentsAsync(((ImgurHoloActivity) getActivity()),
                    galleryAlbumData);
            commentsAsync.execute();
            return true;
        } else
            return super.onOptionsItemSelected(item);
    default:
        return super.onOptionsItemSelected(item);
    }
}