33 lines
907 B
Plaintext
Executable File
33 lines
907 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 ConnectOthersUtils {
|
|
|
|
/**
|
|
* 该方法用来拨打电话
|
|
*/
|
|
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);
|
|
}
|
|
|
|
}
|