欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

怎么在A(yíng)ndroid中調(diào)用發(fā)送的短信-創(chuàng)新互聯(lián)

怎么在A(yíng)ndroid中調(diào)用發(fā)送的短信?針對(duì)這個(gè)問(wèn)題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問(wèn)題的小伙伴找到更簡(jiǎn)單易行的方法。

創(chuàng)新互聯(lián)主營(yíng)正鑲白網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,重慶APP開(kāi)發(fā)公司,正鑲白h5小程序開(kāi)發(fā)搭建,正鑲白網(wǎng)站營(yíng)銷(xiāo)推廣歡迎正鑲白等地區(qū)企業(yè)咨詢(xún)

功能:調(diào)用發(fā)送短信功能

1 、 權(quán)限

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

2、具體實(shí)現(xiàn)

Uri smstoUri = Uri.parse("smsto:"); 
Intent intent = new Intent(Intent.ACTION_VIEW,smstoUri); 
intent.putExtra("address","電話(huà)號(hào)碼"); // 沒(méi)有電話(huà)號(hào)碼的話(huà)為默認(rèn)的,即顯示的時(shí)候是為空的 
intent.putExtra("sms_body","短信內(nèi)容"); // 設(shè)置發(fā)送的內(nèi)容 
intent.setType("vnd.android-dir/mms-sms"); 
startActivity(intent);

Activity 代碼:

public class MainActivity extends Activity { 
 
  private EditText phone ,message; 
  private Button sendbtn; 
  protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
     
    phone = (EditText) findViewById(R.id.phone); 
    message = (EditText) findViewById(R.id.message); 
    sendbtn = (Button) findViewById(R.id.sendbtn); 
     
    //點(diǎn)擊發(fā)送短信 
    sendbtn.setOnClickListener(new OnClickListener() { 
       
      public void onClick(View v) { 
        String p = phone.getText().toString(); 
        String m = message.getText().toString(); 
        Uri smstoUri = Uri.parse("smsto:"); // 解析地址 
        Intent intent = new Intent(Intent.ACTION_VIEW,smstoUri); 
        intent.putExtra("address",p); // 沒(méi)有電話(huà)號(hào)碼的話(huà)為默認(rèn)的,即顯示的時(shí)候是為空的 
        intent.putExtra("sms_body",m); // 設(shè)置發(fā)送的內(nèi)容 
        intent.setType("vnd.android-dir/mms-sms"); 
        startActivity(intent); 
      } 
    }); 
  } 
}

 Mainfest.xml 配置文件:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
  package="com.example.message" 
  android:versionCode="1" 
  android:versionName="1.0" > 
 
  <uses-sdk 
    android:minSdkVersion="10" 
    android:targetSdkVersion="10" /> 
 
  <application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
      android:name="com.example.message.MainActivity" 
      android:label="@string/app_name" > 
      <intent-filter> 
        <action android:name="android.intent.action.MAIN" /> 
 
        <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
    </activity> 
  </application> 
 
  <!-- 發(fā)送短信權(quán)限 --> 
  <uses-permission android:name="android.permission.SEND_SMS" /> 
 
</manifest>

布局示意圖:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  xmlns:tools="http://schemas.android.com/tools" 
  android:layout_width="match_parent" 
  android:layout_height="match_parent" 
  android:paddingBottom="@dimen/activity_vertical_margin" 
  android:paddingLeft="@dimen/activity_horizontal_margin" 
  android:paddingRight="@dimen/activity_horizontal_margin" 
  android:paddingTop="@dimen/activity_vertical_margin" 
  tools:context=".MainActivity" > 
 
  <EditText 
    android:id="@+id/phone" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:ems="10" 
    android:inputType="number" > 
 
    <requestFocus /> 
  </EditText> 
 
  <Button 
    android:id="@+id/sendbtn" 
     
    android:layout_width="150dp" 
    android:layout_height="50dp" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" 
    android:layout_marginBottom="28dp" 
    android:text="Send" /> 
 
  <EditText 
    android:id="@+id/message" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/sendbtn" 
    android:layout_alignLeft="@+id/phone" 
    android:layout_marginBottom="48dp" 
    android:ems="10" /> 
 
</RelativeLayout>

關(guān)于怎么在A(yíng)ndroid中調(diào)用發(fā)送的短信問(wèn)題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒(méi)有解開(kāi),可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識(shí)。

網(wǎng)站題目:怎么在A(yíng)ndroid中調(diào)用發(fā)送的短信-創(chuàng)新互聯(lián)
文章網(wǎng)址:http://aaarwkj.com/article2/hopic.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航、云服務(wù)器定制網(wǎng)站、移動(dòng)網(wǎng)站建設(shè)、自適應(yīng)網(wǎng)站、手機(jī)網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

微信小程序開(kāi)發(fā)

網(wǎng)站設(shè)計(jì)公司知識(shí)

久久久精品国产亚洲av色哟哟| 国产成十人十综合十亚洲| 国产av一区二区三区久久| 国产精品大全中文字幕| 在线中文字幕日韩有码| 三欲一区二区三区中文字幕| 国产日韩精品欧美综合区| 免费欧美大片在线观看高清| 国产精品原创传媒在线观看| 夜夜爽精品国产亚洲av成人| 亚洲一级特黄大片在线观看| 天堂中文字幕在线乱码一区| 日韩中文字幕一区二区不卡| 国产情侣自拍视频在线观看 | 国产精品国产精品三级在线观看| 日本人妻免费在线观看| 一区二区亚洲成人精品| 免费人成视频在线观看不卡| 国产高清在线不卡一区| 日韩欧美高清一区二区| 欧美一区二区国产精品日韩| 亚洲一区二区三区日本久久| 开心激情欧美一区二区| 欧美激情网页一区三区| 久久亚洲综合精品人妻| 久草热不卡的av在线| 十八女毛片一区二区三区| 亚州欧美制服另类国产| 亭亭丁香激情五月涩久久| 欧美高清成人一区二区三区| 亚洲福利影院一区久久| 最新日本人妻中文字幕| 未满十八禁止在线播放| 亚洲性图中文字幕在线| 国产精品自产在线观看一| 有码国内精品人妻少妇| 熟女俱乐部五十路六十路| 日韩黄色精品中文视频| 中文字幕精品人妻在线| 亚洲欧美日韩综合精品久久| 青青草免费在线播放视频网站|