Example usage for android.app Activity finish

List of usage examples for android.app Activity finish

Introduction

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

Prototype

public void finish() 

Source Link

Document

Call this when your activity is done and should be closed.

Usage

From source file:Main.java

@SuppressWarnings("rawtypes")
public static void startOneActivity(Activity mActivity, Class cls) {
    Intent intent = new Intent(mActivity, cls);
    mActivity.startActivity(intent);// w  w  w.j a v  a  2 s.  c om
    mActivity.finish();
}

From source file:Main.java

public static void finishActivity(Activity... activity) {
    if ((activityList != null) && (activity != null)) {
        for (int i = 0; i < activity.length; i++) {
            Activity act = activity[i];
            if (act == null) {
                return;
            }// w  ww  . j av a 2  s .c  o  m
            act.finish();
        }
    }
}

From source file:Main.java

/**
 * Liefert ein Runnable, welches eine Activity beendet
 *
 * @param pActivity die zu beendende Activity
 *//*from w w  w. j  a v  a 2  s. c  o  m*/
public static Runnable getFinishRunable(final Activity pActivity) {
    return new Runnable() {
        @Override
        public void run() {
            pActivity.finish();
        }
    };
}

From source file:com.yixia.zi.utils.UIUtils.java

/**
 * Set the theme of the Activity, and restart it by creating a new Activity of
 * the same type.//  ww  w.ja  v a  2 s  .  c  o m
 */
public static void changeToTheme(Activity activity) {
    activity.finish();
    activity.startActivity(new Intent(activity, activity.getClass()));
}

From source file:Main.java

/**
 * call when you need to transit form one activity to another
 * @param shouldFinishContext: true if you want to finish context of the current activity, false otherwise
 */// w  w  w  .  j  ava 2  s .  co m
public static void changeActivity(Activity source, Class<?> destination, Boolean shouldFinishContext) {
    if (shouldFinishContext) {
        source.finish();
    }
    Intent intent = new Intent(source, destination);
    source.startActivity(intent);
}

From source file:Main.java

public static void startActivity(Activity activity, Class clazz) {
    Intent intent = new Intent(activity, clazz);
    activity.startActivity(intent);/*from   w  w  w . ja  v  a2  s  .  c  o m*/
    activity.finish();
}

From source file:br.fucapi.fapeam.monitori.eula.Eula.java

private static void refuse(Activity activity) {
    activity.finish();
}

From source file:Main.java

public static void finishWithResultCode(Activity context, int resultCode) {
    Activity parentActivity = context.getParent();
    context.setResult(resultCode);//from w w  w.j av  a 2  s  .com
    context.finish();
    if (parentActivity != null) {
        parentActivity.overridePendingTransition(0, android.R.anim.slide_out_right);
    } else {
        context.overridePendingTransition(0, android.R.anim.slide_out_right);
    }
}

From source file:Main.java

public static void endAppFailure(Activity activity, int id) {
    Toast.makeText(activity, activity.getResources().getString(id), Toast.LENGTH_LONG).show();
    activity.finish();
}

From source file:Main.java

public static void sendTo(Activity activity, Class classTo) {
    Intent intent = new Intent().setClass(activity, classTo);
    activity.startActivity(intent);// w w w  .  ja va 2 s.c  om
    activity.finish();
}