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 startActivity(Context context, Class<? extends Activity> activityClass, Intent intent) {
    intent.setClass(context, activityClass);
    context.startActivity(intent);//  ww w.j a  v a 2  s .  c  o  m
}

From source file:Main.java

public static void startActivity(Context context, Class clazz) {
    Intent intent = new Intent();
    intent.setClass(context, clazz);
    context.startActivity(intent);//  w  w  w .  j  a  v a  2  s  .c o  m
}

From source file:Main.java

public static void turnToActivity(Context context, Class activityClass) {
    Intent intent = new Intent();
    intent.setClass(context, activityClass);
    context.startActivity(intent);//  ww w.  j  a  v  a  2s  .  com
}

From source file:Main.java

public static void to(Context context, Class<?> toClass) {
    Intent intent = new Intent();
    intent.setClass(context, toClass);
    context.startActivity(intent);//w w w. j av a  2 s .  co m
}

From source file:Main.java

public static void startActivity(Context context, Class<? extends Activity> clazz) {
    Intent intent = new Intent();
    intent.setClass(context, clazz);
    context.startActivity(intent);// ww w . ja va  2 s .c o  m
}

From source file:Main.java

public static void ActivitySkip(Context context, Class<?> toClass) {
    Intent intent = new Intent();
    intent.setClass(context, toClass);
    context.startActivity(intent);//from   www.j a  v a2 s  .com
}

From source file:Main.java

public static void animTo(Activity activity, Class<?> toClass, int enterAnim, int exitAnim) {
    Intent intent = new Intent();
    intent.setClass(activity, toClass);
    activity.startActivity(intent);//ww w  .jav a  2  s. c om
    activity.overridePendingTransition(enterAnim, exitAnim);
}

From source file:Main.java

public static void startActivityForResult(Activity context, Class<?> cls, int requestCode) {
    Intent intent = new Intent();
    intent.setClass(context, cls);
    context.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static void InvokeActivity(Activity activity, Class class1) {
    Intent intent = new Intent();
    intent.setClass(activity, class1);
    intent.addCategory("android.intent.category.DEFAULT");
    activity.startActivity(intent);//w  ww  . java  2  s  . com
}

From source file:Main.java

public static void putData(Context context, Class<?> activity, String key, String value) {
    Intent intent = new Intent();
    intent.setClass(context, activity);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    intent.putExtra(key, value);//  ww  w  . ja  v  a 2 s.  c  o  m
    context.startActivity(intent);
}