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

/**
 * Starts Activity by creating an intent
 * @param context//from   w w w  .  j  av  a2  s .  c o  m
 * @param clazz
 */
public static void startActivity(Context context, Class clazz) {
    Intent intent = new Intent(context, clazz);
    context.startActivity(intent);
}

From source file:Main.java

@SuppressWarnings("rawtypes")
public static void startOneActivityByContext(Context mActivity, Class cls) {
    Intent intent = new Intent(mActivity, cls);
    mActivity.startActivity(intent);
    ((Activity) mActivity).finish();//from w w w . j  a  va2  s .  c  om
}

From source file:Main.java

public static void startActivityAndFinish(Context mContext, Class<?> T) {
    Intent intent = new Intent(mContext, T);
    mContext.startActivity(intent);
    ((Activity) mContext).finish();/*from w  w  w  .j av  a2 s .  c o m*/
}

From source file:Main.java

public static void launchUrl(String url, Context context) {
    if (!url.isEmpty() && context != null) {
        context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    }/*from w ww. jav a  2 s .  c o m*/
}

From source file:Main.java

public static void goToNetworkSetting(Context context) {
    Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS);
    context.startActivity(intent);
}

From source file:Main.java

public static void next(Context context, Intent intent) {
    if (context != null && intent != null)
        context.startActivity(intent);
}

From source file:Main.java

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

From source file:Main.java

public static void startNetworkSettingActivity(Context context) {
    Intent intent = new Intent("android.settings.WIRELESS_SETTINGS");
    context.startActivity(intent);
}

From source file:Main.java

public static void toSettingActivity(Context mContext) {
    Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS);
    mContext.startActivity(settingsIntent);
}

From source file:Main.java

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