Android Activity Start goToActivity(Context currentActivity, Class newClass, List extras)

Here you can find the source of goToActivity(Context currentActivity, Class newClass, List extras)

Description

go To Activity

Declaration

public static void goToActivity(Context currentActivity,
            Class<? extends Activity> newClass, List<NameValuePair> extras) 

Method Source Code

//package com.java2s;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import org.apache.http.NameValuePair;
import java.util.List;

public class Main {
    public static void goToActivity(Context currentActivity,
            Class<? extends Activity> newClass, List<NameValuePair> extras) {
        Intent newActivity = new Intent(currentActivity, newClass);

        if (extras != null) {
            NameValuePair thisExtra = null;
            for (int x = 0; x < extras.size(); x++) {
                thisExtra = extras.get(x);
                newActivity.putExtra(thisExtra.getName(),
                        thisExtra.getValue());
            }//from  w w  w  . ja v a  2  s  .  c om
        }

        currentActivity.startActivity(newActivity);
    }
}

Related

  1. goToActivity(Context currentActivity, Class newClass)
  2. openActivity(Context packageContext, int flags, Map pairs, boolean closeCurrentContext, Class activity)
  3. startApkActivity(final Context ctx, String packageName)
  4. restartActivity(final Activity activity)
  5. restartPC(final Activity activity)