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

/**
 * Create a precondition activity intent.
 * /*from  w  ww  . j  av  a  2 s  .c o  m*/
 * @param activity
 *            the original activity
 * @param preconditionActivityClazz
 *            the precondition activity's class
 * @return an intent which will launch the precondition activity.
 */
public static Intent createPreconditionIntent(Activity activity, Class<?> preconditionActivityClazz) {
    Intent newIntent = new Intent();
    newIntent.setClass(activity, preconditionActivityClazz);
    newIntent.putExtra(EXTRA_WRAPPED_INTENT, activity.getIntent());
    return newIntent;
}

From source file:Main.java

public static void startActivity(Intent intent, Activity activity, Class classActivity) {
    intent.setClass(activity, classActivity);
    activity.startActivity(intent);//from   w  ww  . j a  v a2 s. c o m
}

From source file:Main.java

public static void goToActivity(Context packageContext, Class<?> targetActivityClass, String paraName,
        Object paramValue) {//  ww w  .  j  av a 2s . com
    Intent intent = new Intent();
    intent.setClass(packageContext, targetActivityClass);
    Bundle bundle = new Bundle();
    if (paramValue instanceof String) {
        bundle.putString(paraName, (String) paramValue);
    } else {
        bundle.putInt(paraName, (int) paramValue);
    }
    intent.putExtras(bundle);
    packageContext.startActivity(intent);
}

From source file:Main.java

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

From source file:Main.java

public static void sendIntent(Context context, Class classes, String key, String value) {
    Intent intent = new Intent();
    intent.setClass(context, classes);
    intent.putExtra(key, value);/*from w ww. j  a  v  a  2 s.  co  m*/
    context.startActivity(intent);
}

From source file:Main.java

public static void sendIntent(Context context, Class classes, String key, Parcelable value) {
    Intent intent = new Intent();
    intent.setClass(context, classes);
    intent.putExtra(key, value);/*w  w  w.j  a v  a  2  s . c  o m*/
    context.startActivity(intent);
}

From source file:Main.java

public static void startActivity(Context mContext, Class className) {
    Intent intent = new Intent();
    intent.setClass(mContext, className);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mContext.startActivity(intent);/*from   w  w w  .  j ava2s .  c  o m*/
}

From source file:Main.java

public static void sendIntent(Context context, Class classes, String key,
        ArrayList<? extends Parcelable> value) {
    Intent intent = new Intent();
    intent.setClass(context, classes);
    intent.putParcelableArrayListExtra(key, value);
    context.startActivity(intent);/*  w w w  .  j a va 2s.  com*/
}

From source file:Main.java

public static void sendIntent(Context context, Class classes, String key, String value, String anotherKey,
        String anotherValue) {/*from  w  ww.  jav  a  2s.co m*/
    Intent intent = new Intent();
    intent.setClass(context, classes);
    intent.putExtra(key, value);
    intent.putExtra(anotherKey, anotherValue);
    context.startActivity(intent);
}

From source file:Main.java

public static void sendIntent(Context context, Class classes, String key, ArrayList<? extends Parcelable> value,
        String anotherKey, String anotherValue) {
    Intent intent = new Intent();
    intent.setClass(context, classes);
    intent.putParcelableArrayListExtra(key, value);
    intent.putExtra(anotherKey, anotherValue);
    context.startActivity(intent);//from  ww  w . j a  v a2s  .  c  om
}