Java Code Examples for androidx.core.content.ContextCompat#startActivity()
The following examples show how to use
androidx.core.content.ContextCompat#startActivity() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TwaLauncher.java From android-browser-helper with Apache License 2.0 | 6 votes |
private void launchWhenSplashScreenReady(TrustedWebActivityIntentBuilder builder, @Nullable Runnable completionCallback) { if (mDestroyed || mSession == null) { return; // Service was disconnected and / or TwaLauncher was destroyed while preparing // the splash screen (e.g. user closed the app). See https://crbug.com/1052367 // for further details. } Log.d(TAG, "Launching Trusted Web Activity."); Intent intent = builder.build(mSession).getIntent(); FocusActivity.addToIntent(intent, mContext); ContextCompat.startActivity(mContext, intent, null); // Remember who we connect to as the package that is allowed to delegate notifications // to us. mTokenStore.store(Token.create(mProviderPackage, mContext.getPackageManager())); if (completionCallback != null) { completionCallback.run(); } }
Example 2
Source File: ActivityGlobalAbstract.java From dhis2-android-capture-app with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void startActivity(@NonNull Class<?> destination, @Nullable Bundle bundle, boolean finishCurrent, boolean finishAll, @Nullable ActivityOptionsCompat transition) { Intent intent = new Intent(this, destination); if (finishAll) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); if (bundle != null) intent.putExtras(bundle); if (transition != null) ContextCompat.startActivity(this, intent, transition.toBundle()); else ContextCompat.startActivity(this, intent, null); if (finishCurrent) finish(); }
Example 3
Source File: NavigationDrawerFragment.java From Hentoid with Apache License 2.0 | 5 votes |
private void launchActivity(@NonNull Class activityClass) { Intent intent = new Intent(parentActivity, activityClass); Bundle bundle = ActivityOptionsCompat .makeCustomAnimation(parentActivity, R.anim.fade_in, R.anim.fade_out) .toBundle(); ContextCompat.startActivity(parentActivity, intent, bundle); parentActivity.overridePendingTransition(R.anim.fade_in, R.anim.fade_out); parentActivity.closeNavigationDrawer(); }
Example 4
Source File: CustomTabsIntent.java From Telegram-FOSS with GNU General Public License v2.0 | 2 votes |
/** * Convenience method to launch a Custom Tabs Activity. * @param context The source Context. * @param url The URL to load in the Custom Tab. */ public void launchUrl(Context context, Uri url) { intent.setData(url); ContextCompat.startActivity(context, intent, startAnimationBundle); }
Example 5
Source File: CustomTabsIntent.java From Telegram with GNU General Public License v2.0 | 2 votes |
/** * Convenience method to launch a Custom Tabs Activity. * @param context The source Context. * @param url The URL to load in the Custom Tab. */ public void launchUrl(Context context, Uri url) { intent.setData(url); ContextCompat.startActivity(context, intent, startAnimationBundle); }