Android Activity Start goToActivity(Context currentActivity, Class newClass)

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

Description

Switches to the given class (which must be a subclass of Activity).

Declaration

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

Method Source Code

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

public class Main {
    /** Switches to the given class (which must be a subclass of Activity). 
     *  You must also register the new Activity in AndroidManifest.xml.
     *//*from   w w w . j  a v a2s.  c o  m*/
    public static void goToActivity(Context currentActivity,
            Class<? extends Activity> newClass) {
        Intent newActivity = new Intent(currentActivity, newClass);
        currentActivity.startActivity(newActivity);
    }
}

Related

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