
Android
onCreate(savedInstanceState);setcontentView(R。layout。activity_mAIn);sendBtn=(Button)findViewById(R。id。btnSendSMS);txtphoneNo=(EditText)findViewById(R。
id。editTextPhoneNo);txtMessage=(EditText)findViewById(R。id。editTextSMS);sendBtn。setOnClickListener(newView。OnClickListener(){publicvoidonClick(Viewview){sendSMSMessage();}});}protectedvoidsendSMSMessage(){Log。

AI
getDefault();smsManager。sendTextMessage(phoneNo,null,message,null,null);Toast。makeText(getApplicationContext(),"SMSsent。
",Toast。LENGTH_LONG)。show();}catch(Exceptione){Toast。makeText(getApplicationContext(),"SMSfAIld,pleasetryagAIn。
",Toast。LENGTH_LONG)。show();e。printStackTrace();}}@OverridepublicbooleanonCreateOptionsMenu(Menumenu){//Inflatethemenu;thisaddsitemstotheactioNBArifitispresent。
getMenuInflater()。inflate(R。menu。mAIn,menu);returntrue;}}最佳答案AndroidSDK不支持双SIM卡设备。您需要与设备制造商联系,以确定是否以及如何使用第二张SIM卡发送短信。
Copyright © 2025 IZhiDa.com All Rights Reserved.
知答 版权所有 粤ICP备2023042255号