start Activity And Finish - Android Activity

Android examples for Activity:Activity Start

Description

start Activity And Finish

Demo Code


//package com.java2s;
import android.app.Activity;
import android.content.Intent;

public class Main {

    public static void startActivityAndFinish(Activity activity,
            Class<?> cls) {

        Intent intent = new Intent(activity, cls);
        activity.startActivity(intent);/*  w w w  .j a  va  2  s  .c o m*/
        activity.finish();
    }

    public static void startActivity(Activity activity, Class<?> cls) {

        Intent intent = new Intent(activity, cls);
        activity.startActivity(intent);
    }
}

Related Tutorials