Example usage for android.app Activity startActivity

List of usage examples for android.app Activity startActivity

Introduction

In this page you can find the example usage for android.app Activity startActivity.

Prototype

@Override
public void startActivity(Intent intent) 

Source Link

Document

Same as #startActivity(Intent,Bundle) with no options specified.

Usage

From source file:com.github.rutvijkumar.twittfuse.Util.java

private static void search(Activity activity, String query) {
    Intent searchIntent = new Intent(activity, SearchActivity.class);
    searchIntent.putExtra("SEARCH_QUERY", query);
    activity.startActivity(searchIntent);
}

From source file:android.fj.com.rxactivity.PermissionInterceptorActivity.java

static Observable<Pair<String[], int[]>> subscribe(final Activity activity, final String[] permissions) {
    return Observable.create(new ObservableOnSubscribe<Pair<String[], int[]>>() {
        @Override/*from  ww  w.  j av a  2 s .c o  m*/
        public void subscribe(final ObservableEmitter<Pair<String[], int[]>> e) throws Exception {
            PermissionInterceptorActivity.param = permissions;
            PermissionInterceptorActivity.resultEmitter = e;

            activity.startActivity(new Intent(activity, PermissionInterceptorActivity.class)
                    .addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION));
        }
    });
}

From source file:com.brq.wallet.activity.export.BackupToPdfActivity.java

public static void callMe(Activity currentActivity) {
    Intent intent = new Intent(currentActivity, BackupToPdfActivity.class);
    currentActivity.startActivity(intent);
}

From source file:com.bluros.music.utils.NavigationUtils.java

public static void navigateToSettings(Activity context) {
    final Intent intent = new Intent(context, SettingsActivity.class);
    if (!PreferencesUtility.getInstance(context).getSystemAnimations()) {
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    }//ww w  .j ava2 s  .c o m
    intent.setAction(Constants.NAVIGATE_SETTINGS);
    context.startActivity(intent);
}

From source file:com.nextgis.mobile.fragment.SettingsFragment.java

public static void initializeTheme(final Activity activity, final ListPreference theme) {
    if (null != theme) {
        theme.setSummary(theme.getEntry());

        theme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
            @Override/* ww w  .j  a  v a2s.c  om*/
            public boolean onPreferenceChange(Preference preference, Object newValue) {
                activity.startActivity(activity.getIntent());
                activity.finish();
                return true;
            }
        });
    }
}

From source file:Main.java

public static boolean startActivity(Activity a, String packageName, Bundle args) {
    PackageManager pm = a.getPackageManager();
    boolean result = true;
    try {/* w w  w. j  a v a 2  s.c o m*/
        Intent intent = pm.getLaunchIntentForPackage(packageName);
        if (null != intent) {
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            if (args != null)
                intent.putExtras(args);
            a.startActivity(intent);
        } else {
            result = startActivityUsingScheme(a, packageName, args);
        }
    } catch (Exception e) {
        Log.e(a.getClass().getName(), e.getMessage(), e);
        result = startActivityUsingScheme(a, packageName, args);
    }
    return result;
}

From source file:com.asburymotors.android.disneysocal.ui.DetailActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void launch(Activity activity, String attraction, View heroView) {
    Intent intent = getLaunchIntent(activity, attraction);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, heroView,
                heroView.getTransitionName());
        ActivityCompat.startActivity(activity, intent, options.toBundle());
    } else {/*  w  w w.j  ava  2s.  co m*/
        activity.startActivity(intent);
    }
}

From source file:com.gc.markdown.utils.ViewUtils.java

public static void startActivity(Intent intent, Activity activity, View sharedElement,
        String sharedElementName) {
    ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
            sharedElement, sharedElementName);
    try {//  w ww .  j  a  v a2  s .c  om
        ActivityCompat.startActivity(activity, intent, optionsCompat.toBundle());
        //?
    } catch (IllegalArgumentException e) {
        activity.startActivity(intent);// ?
    }
}

From source file:Main.java

public static void restartActivity(Activity activity) {

    if (activity == null)
        return;/*w w w . j  av a  2 s .c  o m*/

    if (Build.VERSION.SDK_INT >= 11) {
        activity.recreate();
    } else {
        Intent intent;
        intent = activity.getIntent();
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION
                | Intent.FLAG_ACTIVITY_NEW_TASK);
        activity.finish();
        activity.overridePendingTransition(0, 0);
        activity.startActivity(intent);
        activity.overridePendingTransition(0, 0);
    }

}

From source file:Main.java

public static void startInstalledAppDetailsActivity(@Nullable final Activity context) {
    if (context == null) {
        return;//from   w ww.j a v  a  2 s.  co m
    }
    final Intent i = new Intent();
    i.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    i.addCategory(Intent.CATEGORY_DEFAULT);
    i.setData(Uri.parse("package:" + context.getPackageName()));
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
    i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
    context.startActivity(i);
}