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:Main.java

public static void startActivity(Activity activity, Intent intent) {
    activity.startActivity(intent);
}

From source file:Main.java

public static void switchToWithFadeEffect(Activity activity, Intent intent) {
    activity.startActivity(intent);
    activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}

From source file:Main.java

public static void startByFade(Activity context, Class<?> clazz) {
    context.startActivity(new Intent(context, clazz));
    context.overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}

From source file:Main.java

public static void enterActivity(Activity activity, Intent intent) {
    activity.startActivity(intent);
}

From source file:Main.java

/**
 * Start new activity and finish previous one.
 *
 * @param activity is current activity to finish
 * @param intent   of new activity to start
 *//*  w w w  .j  a  va2 s  .c om*/
public static void startActivityAndFinishPreviousOne(Activity activity, Intent intent) {
    activity.startActivity(intent);
    activity.finish();
}

From source file:Main.java

public static void startActivity(Activity activity, Class<? extends Activity> clazz) {
    activity.startActivity(new Intent(activity, clazz));
}

From source file:Main.java

/**
 * Start the original activity, and finish the precondition activity.
 * @param preconditionActivity/* w ww. j a va  2 s .  com*/
 */
public static void startOriginalActivityAndFinish(Activity preconditionActivity) {
    preconditionActivity
            .startActivity((Intent) preconditionActivity.getIntent().getParcelableExtra(EXTRA_WRAPPED_INTENT));
    preconditionActivity.finish();
}

From source file:Main.java

/**
 * Start the precondition activity using a given intent, which should
 * have been created by calling createPreconditionIntent.
 * @param activity//  w w  w .  ja v  a  2s.  c  o m
 * @param intent
 */
public static void startPreconditionActivityAndFinish(Activity activity, Intent intent) {
    activity.startActivity(intent);
    activity.finish();
}

From source file:Main.java

public static void restartActivity(Activity activity) {
    activity.finish();
    activity.startActivity(activity.getIntent());
}

From source file:Main.java

public static boolean myStartActivity(Activity activity, Intent intent) {
    try {//from w w  w. java 2 s  .c  o  m
        activity.startActivity(intent);
        return true;
    } catch (ActivityNotFoundException e) {
        return false;
    } catch (Exception ex) {
        ex.printStackTrace();
        return false;
    }
}