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

From source file:Main.java

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

From source file:Main.java

public static void searchWeb(Context context, String word) {
    Intent i = new Intent(Intent.ACTION_WEB_SEARCH);
    i.putExtra(SearchManager.QUERY, word);
    context.startActivity(i);
}

From source file:Main.java

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

From source file:Main.java

public static void bootApp(Context context, String activityName) {
    Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(activityName);
    context.startActivity(launchIntent);
}

From source file:Main.java

public static boolean openUrlSchema(Context context, String uri) {
    try {//from   w  w w.  j  ava2s  .  co m
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
        context.startActivity(intent);
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
    return true;
}

From source file:Main.java

public static void openPost(Context context, String postUrl) {
    try {//from w  w  w  .  j  a  v a  2  s .c  om
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(postUrl));
        context.startActivity(intent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void goToWebPage(Context context, String url) {
    Uri uriUrl = Uri.parse(url);/* w  w w  .j  av a  2s.  c o  m*/
    Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
    context.startActivity(launchBrowser);
}

From source file:Main.java

private static void uninstallManually(Context context, String packageName) {
    Intent intent = new Intent(Intent.ACTION_DELETE, Uri.fromParts("package", packageName, null));
    context.startActivity(intent);
}

From source file:Main.java

public static void skipActivity(Context context, Class<?> goal, Bundle bundle) {
    Intent intent = new Intent(context, goal);
    intent.putExtras(bundle);/*from  www  . j av a  2  s.  co  m*/
    context.startActivity(intent);
}