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 uninstallAPK(Context context, String packageName) {
    context.startActivity(new Intent("android.intent.action.DELETE",
            Uri.parse(new StringBuilder("package:").append(packageName).toString())));
}

From source file:Main.java

public static void call(Context context, String phoneNumber) {
    context.startActivity(new Intent("android.intent.action.CALL", Uri.parse("tel:" + phoneNumber)));
}

From source file:Main.java

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

From source file:Main.java

public static void startMyActivity(Context context, int arg0, int arg1) {
    context.startActivity(
            new Intent().setComponent(new ComponentName(packageName, packageName + classNames[arg0][arg1])));
}

From source file:Main.java

public static void startAppByPackageName(Context context, String s) {
    new Intent();
    context.startActivity(context.getPackageManager().getLaunchIntentForPackage(s));
}

From source file:Main.java

public static void toMarket(Context context) {
    try {// w  w  w .  j a va  2s.  co  m
        context.startActivity(
                new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + context.getPackageName())));
    } catch (android.content.ActivityNotFoundException e) {
        Log.e(TAG, "market can't open " + e);
    }
}

From source file:Main.java

public static void runApp(Context context, String packagename) {
    context.startActivity(new Intent(context.getPackageManager().getLaunchIntentForPackage(packagename)));
}

From source file:Main.java

/**
 * Starts Google Play Services in Play application.
 * @param context/*from   ww  w.j  av a 2  s.c  o m*/
 */
public static void startGooglePlayServicesRefresh(Context context) {
    try {
        context.startActivity(new Intent(Intent.ACTION_VIEW,
                Uri.parse("http://play.google.com/store/apps/details?id=com.google.android.gms")));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void launchUri(Context context, Uri uri) {
    context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
}

From source file:Main.java

public static void startActivity(Context context, Class<?> clz, boolean isFinishSelf) {
    context.startActivity(new Intent(context, clz));
    if (isFinishSelf) {
        ((Activity) context).finish();/*from  ww w .j  a v a 2  s  .c  o m*/
    }
}