start One Activity By Context then close it - Android android.app

Android examples for android.app:Activity Start

Description

start One Activity By Context then close it

Demo Code

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

public class Main{

    public static void startOneActivityByContext(Context mActivity,
            Class cls) {/*  ww w . j a va  2  s  .  com*/
        Intent intent = new Intent(mActivity, cls);
        mActivity.startActivity(intent);
        ((Activity) mActivity).finish();
    }

}

Related Tutorials