Example usage for android.content Context startActivity

List of usage examples for android.content Context startActivity

Introduction

In this page you can find the example usage for android.content Context startActivity.

Prototype

public abstract void startActivity(@RequiresPermission Intent intent);

Source Link

Document

Same as #startActivity(Intent,Bundle) with no options specified.

Usage

From source file:Main.java

/**
 * start target activity/*from w  w  w  . j  a  v  a2s .c o m*/
 * */
public static void start(@NonNull Context context, @NonNull Class<? extends Activity> clazz) {
    context.startActivity(new Intent(context, clazz));
}

From source file:Main.java

public static void jumpToActivity(Context context, Intent datatIntent) {
    context.startActivity(datatIntent);
}

From source file:Main.java

public static void toActivity(Context mContext, Class T) {
    Intent intent = new Intent(mContext, T);
    mContext.startActivity(intent);
}

From source file:Main.java

public static void toNextActivity(Context mContext, Class<?> cls) {
    Intent i = new Intent(mContext, cls);
    mContext.startActivity(i);
}

From source file:Main.java

public static void goToActivity(Context context, Class cls) {
    Intent intent = new Intent(context, cls);
    context.startActivity(intent);
}

From source file:Main.java

/**
 * Returns true if an activity with the given intent is successfully started
 * @param context/*from  w w  w.ja  va  2  s  .c om*/
 * @param intent
 * @return
 */
protected static boolean startActivity(@NonNull Context context, Intent intent) {
    try {
        context.startActivity(intent);
    } catch (ActivityNotFoundException ae) {
        return false;
    }

    return true;
}

From source file:Main.java

public static void openWeb(Context context, String url) {
    Uri uri = Uri.parse(url);// w  w  w  .  j a  v a  2  s  .  co m
    context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
}

From source file:Main.java

public static void sendActivity(Context context, Class<?> cls) {
    Intent intent = new Intent(context, cls);
    context.startActivity(intent);
}

From source file:Main.java

public static void openWirelessSettings(Context context) {
    if (android.os.Build.VERSION.SDK_INT > 10) {
        context.startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS));
    } else {//w  w w  .ja va2s  .c  o m
        context.startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));
    }
}

From source file:Main.java

public static void goActivity(Context context, Class<?> clz) {
    Intent intent = new Intent(context, clz);
    context.startActivity(intent);
}