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

public static void back(Context old, Intent intent) {
    Activity activity = (Activity) old;
    activity.setResult(Activity.RESULT_OK, intent);
    activity.finish();
}

From source file:Main.java

public static void returnControlToCallingActivity(Activity activity) {
    activity.setResult(activity.getIntent().getIntExtra("requestCode", 0));
    activity.finish();
}

From source file:Main.java

public static void finishAllActivity() {
    for (Activity activity : activityLists) {
        if (activity != null && !activity.isFinishing())
            activity.finish();
    }//ww w  .  j a va  2 s  .  c  om
    System.exit(0);
}

From source file:Main.java

public static void animFinish(Activity activity, int enterAnim, int exitAnim) {
    if (activity == null) {
        return;//w ww.  ja v a  2s .c om
    }
    activity.finish();
    activity.overridePendingTransition(enterAnim, exitAnim);
}

From source file:Main.java

public static void finishAllNoMainActivity() {
    for (Activity activity : allA) {
        if (!activity.getClass().getSimpleName().equals("Activity_Main")) {
            activity.finish();
        }//from w  ww  .  j a v  a2s  .  co m
    }
}

From source file:Main.java

private static void closeActivity(Activity activity) {
    Intent intent = activity.getIntent();
    activity.setResult(Activity.RESULT_OK, intent);
    activity.finish();
}

From source file:Main.java

public static void finishAllActivity() {
    if (mActivityList.size() > 0) {
        Iterator<Activity> it = mActivityList.iterator();
        while (it.hasNext()) {
            Activity activity = it.next();
            if (!activity.isFinishing()) {
                activity.finish();
            }// w w  w  . j  a v  a 2s.c o  m
        }
    }
}

From source file:Main.java

public static void finishAllActivity(Activity excludeActivity) {
    if (mActivityList.size() > 0) {
        if (excludeActivity != null) {
            mActivityList.remove(excludeActivity);
        }//from  w  ww.  j a  v  a2 s  .  c om
        Iterator<Activity> it = mActivityList.iterator();
        while (it.hasNext()) {
            Activity activity = it.next();
            if (!activity.isFinishing()) {
                activity.finish();
            }
        }
    }
}

From source file:Main.java

public static View.OnClickListener finish(final Activity activity) {
    return new View.OnClickListener() {
        public void onClick(View v) {
            activity.finish();
        }/*from  w  w w  .ja  v  a  2s  .  c o  m*/
    };
}

From source file:Main.java

public static void startActivityAndFinish(Activity context, Class<?> cls) {
    Intent intent = new Intent(context, cls);
    context.startActivity(intent);//  www . jav a2s.c o m
    context.finish();
}