1. //发短信   
  2. class SendMsgClickListener implements OnClickListener {   
  3.         public void onClick(View v) {   
  4.             //调用Android系统API发送短信   
  5.             Uri uri = Uri.parse("smsto:10086");   
  6.             Intent intent = new Intent(Intent.ACTION_SENDTO, uri);   
  7.             intent.putExtra("sms_body""android...");   
  8.             startActivity(intent);   
  9.         }   
  10.     }   
  11.   
  12. //打电话   
  13. class SendCallClickListener implements OnClickListener {iphone5   
  14.         public void onClick(View v) {   
  15.             //调用Android系统API打电话   
  16.             Uri uri = Uri.parse("tel:10086");   
  17.             Intent intent = new Intent(Intent.ACTION_CALL, uri);   
  18.             startActivity(intent);   
  19.         }   
  20.     }  

授权:需要在AndroidManifest.xml中加入两行配置    
 
  1. <uses-permission android:name="android.permission.CALL_PHONE" />   
  2.   
  3. <uses-permission android:name="android.permission.SEND_SMS"/>  

相关文章:

  • 2022-12-23
  • 2022-01-26
  • 2021-12-23
  • 2021-12-31
  • 2022-12-23
  • 2021-04-29
猜你喜欢
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
  • 2021-07-17
  • 2021-10-19
  • 2021-12-16
  • 2022-01-16
相关资源
相似解决方案