Java tutorial
//package com.java2s; import android.app.Activity; import android.content.Intent; public class Main { public static void gotoActivity(Activity curActivity, Class<?> targetActivity, boolean finish) { Intent intent = new Intent(); intent.setClass(curActivity, targetActivity); curActivity.startActivity(intent); // curActivity.overridePendingTransition(R.anim.slide_left_in, // R.anim.slide_left_out); if (finish) { curActivity.finish(); } } }