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:com.appunite.rx.android.widget.RxActivityMore.java

@Nonnull
public static Action1<? super Object> finish(@Nonnull final Activity activity) {
    return new Action1<Object>() {
        @Override/* w  ww .ja  va 2s  .co  m*/
        public void call(Object o) {
            activity.finish();
        }
    };
}

From source file:com.agna.setmaster.ui.screen.main.MainActivity.java

public static void start(Activity activity) {
    Intent i = new Intent(activity, MainActivity.class);
    i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    activity.finish();
    activity.startActivity(i);// www.j  av a 2  s.  c  o  m
}

From source file:Main.java

public static void startActivity(Activity current, Class<? extends Activity> next) {
    saveActivity(current, next);/*w  w w . j  a v a  2  s  .  c  o m*/
    Intent i = new Intent(current, next);
    current.startActivity(i);
    current.finish();
}

From source file:Main.java

public static void start_new_activity(Activity activity, Class<?> mclass, boolean is_finish_parent) {
    Intent myintent = new Intent(activity, mclass);
    activity.startActivity(myintent);/*from   ww w .  j  av a2 s.  c  o m*/
    if (is_finish_parent)
        activity.finish();
}

From source file:Main.java

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

From source file:Main.java

public static void finishActivity() {
    Activity activity = null;
    int length = arrayList.size() - 1;
    for (int i = length; i >= 0; i--) {
        activity = arrayList.get(i);/*from  w w  w. jav a  2 s.com*/
        if (activity != null) {
            activity.finish();
            arrayList.remove(i);
        }
    }
}

From source file:Main.java

public static void finishOtherZctivity(Activity activity) {
    Activity act = null;
    int length = arrayList.size() - 1;
    for (int i = length; i >= 0; i--) {
        act = arrayList.get(i);//w  ww .  ja v a2s. co m
        if (act != null && act == activity) {
            act.finish();
            arrayList.remove(i);
        }
    }
}

From source file:Main.java

public static void restart(final @NonNull Activity activity) {
    if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
        activity.recreate();/*from w w  w  . ja v a 2s . com*/
    } else {
        final Intent intent = activity.getIntent();
        activity.finish();
        activity.startActivity(intent);
    }
}

From source file:com.crea_si.eviacam.wizard.WizardUtils.java

static void finishWizard(Activity a) {
    a.startActivity(new Intent(a, WizardActivity.class)
            .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS));
    a.finish();
}

From source file:Main.java

public static <T extends Activity> void startActivity(Activity parent, Class<T> clazz, boolean killParent) {
    Intent intent = new Intent(parent, clazz);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    parent.startActivity(intent);//from w w w .j av a 2  s.  com

    if (killParent) {
        parent.finish();
    }
}