Example usage for android.content Intent setClass

List of usage examples for android.content Intent setClass

Introduction

In this page you can find the example usage for android.content Intent setClass.

Prototype

public @NonNull Intent setClass(@NonNull Context packageContext, @NonNull Class<?> cls) 

Source Link

Document

Convenience for calling #setComponent(ComponentName) with the name returned by a Class object.

Usage

From source file:Main.java

public static void startActivityWithNoData(Activity start, Activity from, Class<Activity> end) {
    if (start == null || from == null || end == null)
        return;//from  w w  w  . ja va2s . c o m
    Intent intent = new Intent();
    intent.setClass(from, end);
    start.startActivity(intent);
}

From source file:Main.java

public static void startAct(@NonNull Class cls, @NonNull Intent intent) {
    intent.setClass(mActivity, cls);
    mActivity.startActivity(intent);// w  w w  .j a va2 s .c  om
}

From source file:Main.java

public static void startActivity(Activity activity, Class<?> cls) {
    Intent intent = new Intent();
    intent.setClass(activity, cls);
    activity.startActivity(intent);//www.  j a v  a 2  s .com

}

From source file:Main.java

public static void ActivityChange(Context context, Class<?> toClass) {
    ((Activity) context).finish();/* w  w w .j  a v  a  2 s . c o m*/
    Intent intent = new Intent();
    intent.setClass(context, toClass);
    context.startActivity(intent);
}

From source file:Main.java

public static void Go(Context context, Class<?> class1) {
    Intent intent = new Intent();
    intent.setClass(context, class1);
    context.startActivity(intent);/*w  w w . jav a2 s  .co  m*/
}

From source file:Main.java

public static void startAR(Activity activity, Class<?> c, int requestCode, BasicNameValuePair... name) {
    Intent intent = new Intent();
    intent.setClass(activity, c);
    for (int i = 0; i < name.length; i++) {
        intent.putExtra(name[i].getName(), name[i].getValue());
    }//from   www .j  a  va2  s . c o  m
    activity.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void jump(Context context, Class clazz) {
    Intent intent = new Intent();
    intent.setClass(context, clazz);
    context.startActivity(intent);/*from w  w  w.java 2  s  .  c  om*/
}

From source file:Main.java

public static void startActivity(Activity activity, Class classActivity) {
    Intent intent = new Intent();
    intent.setClass(activity, classActivity);
    activity.startActivity(intent);/* w w  w  . j ava 2 s .c om*/
}

From source file:Main.java

public static void jump(Context context, Class clazz, String key, String value) {
    Intent intent = new Intent();
    intent.setClass(context, clazz);
    intent.putExtra(key, value);//from   w  w  w.  j a  va2  s  .c om
    context.startActivity(intent);
}

From source file:Main.java

public static Intent gotoIntent_WithString(Context context, Class c, String accessName, String value) {
    Bundle bundle = new Bundle();
    bundle.putString(accessName, value);
    Intent intent = new Intent();
    intent.setClass(context, c);
    //intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtras(bundle);/* w w  w .  j  a  va  2  s . c om*/
    return intent;
}