Example usage for android.content Intent ACTION_CALL

List of usage examples for android.content Intent ACTION_CALL

Introduction

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

Prototype

String ACTION_CALL

To view the source code for android.content Intent ACTION_CALL.

Click Source Link

Document

Activity Action: Perform a call to someone specified by the data.

Usage

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  w  w  w  .  ja  v a2 s.c  om
}

From source file:Main.java

public static boolean callPhone(Context context, String phone) {
    try {// www .j a  va 2s.  c o  m
        Intent callIntent = new Intent(Intent.ACTION_CALL);
        callIntent.setData(Uri.parse("tel:" + phone));
        context.startActivity(callIntent);
        return true;
    } catch (ActivityNotFoundException e) {
        return false;
    }
}

From source file:Main.java

public static void callByPhone(Context context, String phone) {
    if (TextUtils.isEmpty(phone)) {
        return;/*from  w w w . jav a2  s  . co m*/
    }

    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phone));
    context.startActivity(intent);
}

From source file:Main.java

public static void call(Context cxt, String number) {
    String phoneUri = "tel:";
    phoneUri = phoneUri.concat(number);//from w  ww  . j  a v a 2s .com
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(phoneUri));
    cxt.startActivity(intent);
}

From source file:Main.java

public static void callPhone(Context ctx, String phoneNumber) {
    if (ctx == null) {
        return;/*from  w w  w  .j av  a  2  s  . c om*/
    }

    if (phoneNumber.isEmpty()) {
        return;
    }

    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));

    ctx.startActivity(intent);

}

From source file:Main.java

public static void callPhone(Context ctx, String phoneNumber) {
    if (ctx == null) {
        return;//from ww  w.  j ava2s.c o  m
    }
    if (phoneNumber == null || phoneNumber.isEmpty()) {
        return;
    }
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));

    //        ctx.startActivity(intent);
}

From source file:Main.java

public static void makePhoneCall(Context context, String phoneNumber) {
    if (null != phoneNumber && phoneNumber.length() > 0) {
        Uri phoneUri = Uri.parse("tel:" + phoneNumber); // Could also use Uri.Builder
        Intent intent = new Intent(Intent.ACTION_CALL, phoneUri);
        context.startActivity(intent);/*from ww  w.  jav a 2s. com*/
    }
}

From source file:Main.java

public static void callPhone(Context context, String phoneNumber) {
    if (!TextUtils.isEmpty(phoneNumber)) {
        try {//  w  w  w .ja v  a2 s.  co  m
            Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));
            context.startActivity(callIntent);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

From source file:Main.java

public static void callPhone(Context ctx, String phoneNumber) {
    if (ctx == null) {
        return;/*from  w  w  w.j  a va 2s .com*/
    }
    if (phoneNumber == null || phoneNumber.isEmpty()) {
        return;
    }
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));

    ctx.startActivity(intent);
}

From source file:Main.java

/**
 * @brief      Get the intent to make a call.
 *
 * @par        Sync (or) Async:// ww w .  ja v a  2 s.  c o  m
 * This is a Synchronous function.
 *
 * @param [IN] telNumber    Telephone number.\n
 * 
 * @return     
 *
 * @author     daiping.zhao
 * @since      1.0.0.0
 * @version    1.0.0.0
 * @par        Prospective Clients:
 * External Classes
 */
public static Intent doCall(String telNumber) {
    Uri uri = Uri.parse("tel:" + telNumber);
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.setData(uri);
    return intent;
}