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 CallPhone(Context context, String phone) {
    Intent intent = new Intent(Intent.ACTION_DIAL);
    Uri data = Uri.parse("tel:" + phone);
    intent.setData(data);//from  ww  w . ja  va 2  s  .co m
    context.startActivity(intent);
}

From source file:Main.java

public static void jump(Context context, Class clazz, String key, String value) {
    Intent intent = new Intent();
    intent.setClass(context, clazz);/*from w  ww.ja v  a2  s . c  o  m*/
    intent.putExtra(key, value);
    context.startActivity(intent);
}

From source file:Main.java

public static void deletePackage(Context context, String packageName) {
    Uri packageURI = Uri.parse("package:" + packageName);
    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
    context.startActivity(uninstallIntent);
}

From source file:Main.java

public static void showGoogleSearchIntent(Context context, String query) {
    Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
    intent.putExtra(SearchManager.QUERY, query); // query contains search string
    context.startActivity(intent);
}

From source file:Main.java

public static void openSendMsg(Context context) {
    Uri uri = Uri.parse("smsto:");
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}

From source file:Main.java

public static void uninstall(Context context, String pkgname) {

    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DELETE);
    intent.setData(Uri.parse("package:" + pkgname));
    context.startActivity(intent);
}

From source file:Main.java

public static final void gotoHome(Context context) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(intent);
}

From source file:Main.java

public static void showDesk(Context context) {
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(intent);
}

From source file:Main.java

public static void goActivity(Context context, Class<?> cls, Bundle bundle) {
    Intent intent = new Intent(context, cls);
    if (null != bundle) {
        intent.putExtras(bundle);/*from   w w w  .j  a v a 2s. co  m*/
    }

    context.startActivity(intent);
}

From source file:Main.java

public static void uninstall(Context context, String packageName) {
    Uri packageURI = Uri.parse("package:" + packageName);
    Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
    context.startActivity(uninstallIntent);
}