Example usage for android.content Intent Intent

List of usage examples for android.content Intent Intent

Introduction

In this page you can find the example usage for android.content Intent Intent.

Prototype

public Intent() 

Source Link

Document

Create an empty intent.

Usage

From source file:Main.java

public static boolean openApp(Activity activity, String action) {
    try {/*from  w  ww. j  a va2  s .  c  o  m*/

        Intent intent = new Intent();
        intent.setAction(action);
        activity.startActivity(intent);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}

From source file:Main.java

public static void callPhone(Context context, String phoneNumber) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + phoneNumber));
    context.startActivity(intent);//from   ww  w  .  j a va  2s  . co m
}

From source file:Main.java

public static void callNumWithDial(Context context, String number) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + number));
    context.startActivity(intent);//from www . j  a v a  2  s . c  o m
}

From source file:Main.java

public static void showAppInfo(String packageName, Context context) {
    Intent intent = new Intent();
    intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
    intent.setData(Uri.parse("package:" + packageName));
    context.startActivity(intent);//w w  w .  j  a v  a  2 s .c  om
}

From source file:Main.java

public static void goMainActivity(Context context) {
    Intent intent = new Intent();
    intent.setClassName("com.nearucenterplaza.redenvelopeassistant",
            "com.nearucenterplaza.redenvelopeassistant.ui.activity.HomeActivity");
    context.startActivity(intent);/*w ww . j  av a 2 s  .  co m*/
}

From source file:Main.java

public static void openAppInfo(Context context, String packageName) {
    Intent intent = new Intent();
    intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
    intent.setData(Uri.parse("package:" + packageName));
    context.startActivity(intent);//www .  ja v  a 2s .co  m
}

From source file:Main.java

public static void installApkFileFromUri(Context context, Uri appPath) {
    Intent intent = new Intent();
    intent.setDataAndType(appPath, "application/vnd.android.package-archive");
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//ww w  .  ja v  a2 s.  c  om
}

From source file:Main.java

public static void openDefaultBrowser(Context context, String url) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");
    Uri content_url = Uri.parse(url);/* www. jav a2s  .c o  m*/
    intent.setData(content_url);
    context.startActivity(intent);
}

From source file:Main.java

public static void jumpToSystemCallActivity(Context context, String number) {
    Intent i = new Intent();
    i.setAction("android.intent.action.CALL");
    i.setData(Uri.parse("tel:" + number));
    i.addFlags(268435456);//  w  w w  .j a v a 2  s  .c  om
    context.startActivity(i);
}

From source file:Main.java

public static void uninstallApp(String packageName, Activity activity) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.DELETE");
    intent.addCategory("android.intent.category.DEFAULT");
    intent.setData(Uri.parse("package:" + packageName));
    activity.startActivityForResult(intent, 0);
}