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

怎么在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í)

丰满多毛熟妇的大阴户| 特级特色生活片免费看| 日本人妻伦理在线播放| 国产91高清免费视频| 日本欧美一区二区二区视频免费| 中文字幕乱码亚洲影视| 亚洲视频在线的视频在| av日韩在线一区二区三区| 亚洲女优中文字幕在线免费| 国产精品 亚洲精品| 国产男女猛进猛出精品91| 国产精品国产三级专区| 加勒比人妻一区二区三区| 国产亚洲精品女人久久久| 久久国产欧美日韩精品| 亚洲精品国产高清久久| 亚洲黄色av网址在线观看| 97精品少妇一区二区三区| 亚洲和欧洲一码二码区视频| 日本的黄色录像一级带| 精品人妻一区二区四区| 亚洲精品欧美无人区乱码| 亚洲综合一区二区三区不卡| 亚洲av毛片免费在线| 中文字幕三级电影天堂| 熟妇人妻久久中文字幕麻豆网| 国产日韩欧美另类专区| 未满十八禁在线观看免费| 日本熟女肥臀一区二区| 色综合色综合蘑菇在线| 日本一区二区最新免费| 永久黄区观看在线网址| 中文字幕在线一区国产精品| 亚洲精品偷拍在线观看| 亚洲男女尻逼片视频网站| 国产精品久久久毛片av| 国产亚洲av麻豆精品推荐| 久久综合激情亚洲欧美专区| 美国一级二级三级黄片| 国产精品自拍午夜福利| 人妻少妇被猛烈进入中文字幕91|