XiMengJianYu/.svn/pristine/25/25183f20b63c53ae578cd6fd916f3dd289223a0e.svn-base
2023-04-17 17:58:44 +08:00

33 lines
902 B
Plaintext
Executable File

package com.example.administrator.ximengjianyu.utils;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
/**
* Created by xukai on 2017/2/4.
* 该工具类中,可用来拨打电话、发送短信等
*/
public class CallToSomeone {
/**
* 该方法用来拨打电话
*/
public static void callToSomeone(Context context, String phone) {
Intent intent = new Intent();
intent.setAction("android.intent.action.CALL");
intent.setData(Uri.parse("tel:" + phone));
context.startActivity(intent);
}
/**
* 该方法用来发送短信
*/
public static void sendMessage(Context context, String phone) {
Uri uri = Uri.parse("smsto:" + phone);
Intent sendIntent = new Intent(Intent.ACTION_VIEW, uri);
context.startActivity(sendIntent);
}
}