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

/**
 * Start new activity and finish previous one.
 *
 * @param activity is current activity to finish
 * @param intent   of new activity to start
 *//*from  w ww.  java  2 s .  c  o m*/
public static void startActivityAndFinishPreviousOne(Activity activity, Intent intent) {
    activity.startActivity(intent);
    activity.finish();
}

From source file:Main.java

private static void finishActivity(Activity activity) {
    activity.setResult(Activity.RESULT_OK, new Intent());
    activity.finish();
}

From source file:Main.java

public static void exitAllActivitys() {

    for (Activity activity : activities) {
        if (activity != null)
            activity.finish();
    }//from   www  .  ja va  2  s.  com
}

From source file:Main.java

public static void finishWithoutResult(Activity context) {
    Activity parentActivity = context.getParent();
    context.finish();
    if (parentActivity != null) {
        parentActivity.overridePendingTransition(0, android.R.anim.slide_out_right);
    } else {// w  w w  .  jav a 2s  .c  om
        context.overridePendingTransition(0, android.R.anim.slide_out_right);
    }
}

From source file:Main.java

public static void finshActivities(Activity activity) {
    if (activity == null) {
        return;//from   ww  w. j av a 2 s. co  m
    }
    for (Activity ac : activities) {
        if (ac != activity) {
            ac.finish();
        }
    }
    activities.clear();
}

From source file:Main.java

public static void finishAllActivitys() {
    for (Activity activity : activitys) {
        if (null != activity) {
            activity.finish();
        }// w w w.  jav a  2 s. c  om
    }
}

From source file:Main.java

public static void Finish(Activity activity, Intent data) {
    activity.setResult(Activity.RESULT_OK, data);
    activity.finish();
}

From source file:Main.java

public static void exitApp() {
    for (Activity activity : activitys) {
        if (null != activity) {
            activity.finish();
        }/*from w w w  .  ja v a2s . com*/
    }
    android.os.Process.killProcess(android.os.Process.myPid());
}

From source file:Main.java

public static void removeAllActivity() {

    for (Activity activity : list) {
        if (!activity.isFinishing()) {
            activity.finish();
        }//from ww w .  j av  a  2  s. co m
    }
}

From source file:Main.java

private static void finishAllActivity() {
    for (Activity a : sStack) {
        if (a != null && !a.isFinishing()) {
            a.finish();
        }/*  ww w .j a v a  2  s. c  om*/
    }
    sStack.clear();
}