zoukankan      html  css  js  c++  java
  • 安卓打电话和发短信

    拨打电话:

    权限:


    <uses-permission android:name="android.permission.CALL_PHONE" />

    EditText text=(EditText)findViewById(R.id.txtphone);

    String phone=text.getText().toString();
    Intent intent=new Intent();
    intent.setAction(Intent.ACTION_CALL);
    intent.setData(Uri.parse("tel:"+phone));
    startActivity(intent);

    发送信息:

    权限:
    <uses-permission android:name="android.permission.SEND_SMS"/>

    EditText text=(EditText)findViewById(R.id.txtphone);
    String phone=text.getText().toString();
    EditText text2=(EditText)findViewById(R.id.txtSMS);
    String SMS=text2.getText().toString();
    SmsManager manager= SmsManager.getDefault();
    manager.sendTextMessage(phone, null, SMS, null, null);

  • 相关阅读:
    集合
    3/11
    字典
    3/10
    字符串之不常用方法
    字符串的索引和切片
    数据类型的转化
    Markdown在线编辑器
    3/9
    Django:RestFramework之-------渲染器
  • 原文地址:https://www.cnblogs.com/zhoumingxiu/p/4632729.html
Copyright © 2011-2022 走看看