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

public static void startAttention(Context context, String s) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");
    intent.setData(Uri.parse(s));/*from w  w w  . ja  v  a  2s.co m*/
    intent.setClassName("com.tencent.mm", "com.tencent.mm.ui.qrcode.GetQRCodeInfoUI");
    context.startActivity(intent);
}

From source file:Main.java

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

From source file:Main.java

public static void pickImageFromAlbum(final Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");
    activity.startActivityForResult(intent, REQUEST_CODE_FROM_ALBUM);
}

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);//w  w  w. ja  va 2s.  co  m
}

From source file:Main.java

public static void gotoMarket(Context context, String pck) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("market://details?id=" + pck));
    context.startActivity(intent);/*  w w  w.  ja  v a  2s .c  o m*/
}

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 ava  2s.co  m
}

From source file:Main.java

public static void link(Context context, String url) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.addCategory(Intent.CATEGORY_BROWSABLE);
    intent.setData(Uri.parse(url));/* w w  w  .ja  va 2 s .c o  m*/
    context.startActivity(intent);
}

From source file:Main.java

public static void showViewDial(String phoneNumber, Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_DIAL);
    intent.setData(Uri.parse("tel:" + phoneNumber));
    activity.startActivity(intent);//ww  w  .  j  a  v a 2  s .  c o m
}

From source file:Main.java

public static void directDial(String phoneNumber, Activity activity) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:" + phoneNumber));
    activity.startActivity(intent);//from  www.  ja  v 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);/*from   ww  w .j  a  va  2s.c  o m*/
}