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 startApp(Context context, String packageName) {
    Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName);
    context.startActivity(intent);
}

From source file:Main.java

public static void composeTel(Context context, String phoneNumber) {
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("tel:" + phoneNumber));
    context.startActivity(intent);
}

From source file:Main.java

public static void openApp(Context context, String packageName) {
    Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName);
    context.startActivity(intent);
}

From source file:Main.java

public static void startBrowser(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));/*from  w w  w .  ja v  a  2 s  .  co m*/
    context.startActivity(intent);
}

From source file:Main.java

public static void startMainActivity(Context context) {
    Intent intent = new Intent("MAIN_ACTIVITY");
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(intent);
}

From source file:Main.java

public static void startActivityMarketOnCutinManagerPage(Context context) {
    Intent intent = buildMarketIntent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:Main.java

public static void startApplication(Context mContext, String pkgName) {
    Intent launchIntent = mContext.getPackageManager().getLaunchIntentForPackage(pkgName);
    mContext.startActivity(launchIntent);
}

From source file:Main.java

public static void goWebByUrl(Context context, String url) {
    Uri uri = Uri.parse(url);//from   w ww.ja  v a  2s  .c om
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    context.startActivity(intent);
}

From source file:Main.java

public static void launchApk(Context context, String packageName) {
    Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName);
    context.startActivity(intent);
}

From source file:Main.java

public static void jumpAndId(Context context, Class cla, String nid) {
    Intent intent = new Intent(context, cla);
    intent.putExtra("nid", nid);
    context.startActivity(intent);
}