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

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

From source file:Main.java

public static void viewMaps(Context context, String addressText) {
    String uri = "geo:" + 0 + "," + 0 + "?q=" + addressText;
    context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uri)));
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

/**
 * wifi settings// www . j a v  a2  s. c  o  m
 * 
 * @param context
 */
public static void wifiSettings(Context context) {
    if (context == null)
        return;

    try {
        context.startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS));
    } catch (ActivityNotFoundException e) {
    } catch (Exception e) {
    }
}

From source file:Main.java

/**
 * wireless settings//  w w w .j  a va  2s. c  o m
 * 
 * @param context
 */
public static void wirelessSettings(Context context) {
    if (context == null)
        return;

    try {
        context.startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
    } catch (ActivityNotFoundException e) {
    } catch (Exception e) {
    }
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static void openUrlInBrowser(Context context, String url) {
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    context.startActivity(browserIntent);
}

From source file:Main.java

private static void openUrlInBrowser(Context context, String url) {
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    context.startActivity(browserIntent);
}