Android examples for Activity:Activity Jump
Switch to Activity
import java.lang.reflect.Field; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.Toast; public class Main{ /* w ww . j av a2 s. c o m*/ public static void switchTo(Activity activity, Class<? extends Activity> targetActivity) { Intent intent = new Intent(activity, targetActivity); switchTo(activity, intent); } public static void switchTo(Activity activity, Intent intent) { activity.startActivity(intent); } public static void switchTo(Context context, Intent intent) { context.startActivity(intent); } public static void switchTo(Activity activity, Class<? extends Activity> target, ParamCollection params) { Intent intent = new Intent(activity, target); if (null != params) { for (ParamCollection.NameValue item : params.getParamsList()) { IntentUtil.setValueToIntent(intent, item.name, item.value); } } switchTo(activity, intent); } public static void switchTo(Activity activity, Class<? extends Activity> targetActivity, ParamCollection params, int requestCode) { Intent intent = new Intent(activity, targetActivity); if (null != params) { for (ParamCollection.NameValue item : params.getParamsList()) { IntentUtil.setValueToIntent(intent, item.name, item.value); } } activity.startActivityForResult(intent, requestCode); } public static void switchTo(Activity activity, Class<? extends Activity> targetActivity, int requestCode) { Intent intent = new Intent(activity, targetActivity); activity.startActivityForResult(intent, requestCode); } }