Example usage for android.content Intent setAction

List of usage examples for android.content Intent setAction

Introduction

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

Prototype

public @NonNull Intent setAction(@Nullable String action) 

Source Link

Document

Set the general action to be performed.

Usage

From source file:Main.java

private static void prepareRestartAppIntent(Intent i) {
    i.setAction(Intent.ACTION_MAIN);
    i.addCategory(Intent.CATEGORY_LAUNCHER);
    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

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);/*from   w ww. j  a v a2 s .  c om*/
    context.startActivity(i);
}

From source file:Main.java

public static void broadcastAction(Context context, String action) {
    Intent intent = new Intent();
    intent.setAction(action);
    context.sendBroadcast(intent);/*  w  w w.  j av a2  s  . c o  m*/
}

From source file:Main.java

public static void gotoHome(Context context) {
    Intent intent = new Intent();
    intent.setAction("GotoHome");
    context.sendBroadcast(intent);/*from  w ww  . ja  v  a2 s .co m*/
}

From source file:Main.java

public static void dialIn(Context context, String number) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel://" + number));
    context.startActivity(intent);// w w w . j ava2 s . co m
}

From source file:Main.java

public static Intent toRootPermission() {
    Intent intent = new Intent();
    intent.setAction("miui.intent.action.ROOT_MANAGER");
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    return intent;
}

From source file:Main.java

public static Intent toAutoStartPermission() {
    Intent intent = new Intent();
    intent.setAction("miui.intent.action.OP_AUTO_START");
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    return intent;
}

From source file:Main.java

public static Intent getRouteIntent(Uri uri) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(uri);/*from  w  w w .  j  av  a 2s .com*/
    return intent;
}

From source file:Main.java

public static Intent getShareImageIntent(Uri uri) {
    Intent image = new Intent();
    image.setAction(Intent.ACTION_SEND);
    image.putExtra(Intent.EXTRA_STREAM, uri);
    image.setType("image/*");
    return image;
}

From source file:Main.java

public static void startLauncher(Context context) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_MAIN);
    intent.addCategory(Intent.CATEGORY_HOME);
    context.startActivity(intent);/*from   w w  w.  j  a  va  2  s  .  c  o m*/
}