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

Android中如何實(shí)現(xiàn)短信編輯器功能-創(chuàng)新互聯(lián)

這篇文章主要講解了“Android中如何實(shí)現(xiàn)短信編輯器功能”,文中的講解內(nèi)容簡(jiǎn)單清晰,易于學(xué)習(xí)與理解,下面請(qǐng)大家跟著小編的思路慢慢深入,一起來(lái)研究和學(xué)習(xí)“Android中如何實(shí)現(xiàn)短信編輯器功能”吧!

創(chuàng)新互聯(lián)專(zhuān)業(yè)為企業(yè)提供會(huì)同網(wǎng)站建設(shè)、會(huì)同做網(wǎng)站、會(huì)同網(wǎng)站設(shè)計(jì)、會(huì)同網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、會(huì)同企業(yè)網(wǎng)站模板建站服務(wù),10年會(huì)同做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.dudon.fakesms">
  <uses-permission android:name="android.permission.READ_SMS" />
  <uses-permission android:name="android.permission.WRITE_SMS" />
  <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
  </application>
</manifest>

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical">
  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <TextView
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:gravity="center"
      android:text="短信發(fā)送者:"
      android:textSize="18sp" />
    <EditText
      android:id="@+id/get_phone"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_weight="7"
      android:inputType="phone" />
  </LinearLayout>
  <ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1">
    <EditText
      android:id="@+id/get_message"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_margin="20dp"
      android:hint="短信內(nèi)容" />
  </ScrollView>
  <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <Button
      android:id="@+id/get_time"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_weight="1"
      android:text="添加當(dāng)前時(shí)間" />
    <Button
      android:id="@+id/send_message"
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:layout_weight="4"
      android:text="發(fā)送短信" />
  </LinearLayout>
</LinearLayout>

MainActivity.java

public class MainActivity extends AppCompatActivity {
  private int phoneNum;
  private String textSMS;
  private String currentTime;
  private Button sendMessage;
  private Button getTime;
  private EditText getPhone;
  private EditText getMessage;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    //注冊(cè)控件
    sendMessage = (Button) findViewById(R.id.send_message);
    getTime = (Button) findViewById(R.id.get_time);
    getPhone = (EditText) findViewById(R.id.get_phone);
    getMessage = (EditText) findViewById(R.id.get_message);
    //獲取當(dāng)前時(shí)間
    getTime.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        textSMS = getMessage.getText().toString();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH時(shí)mm分ss秒");
        Date curDate = new Date(System.currentTimeMillis());//獲取當(dāng)前時(shí)間
        currentTime = formatter.format(curDate);
        textSMS = textSMS + currentTime;
        getMessage.setText(textSMS);
      }
    });
    //發(fā)送短信
    sendMessage.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        if (TextUtils.isEmpty(getPhone.getText().toString())) {
          Toast.makeText(MainActivity.this, "電話(huà)號(hào)碼未填寫(xiě)", Toast.LENGTH_SHORT).show();
          return;
        }
        if (TextUtils.isEmpty(getMessage.getText().toString())) {
          Toast.makeText(MainActivity.this, "短信內(nèi)容未填寫(xiě)", Toast.LENGTH_SHORT).show();
          return;
        }
        //獲取電話(huà)號(hào)碼和短信內(nèi)容
        phoneNum = Integer.parseInt(getPhone.getText().toString());
        textSMS = getMessage.getText().toString();
        //開(kāi)啟多線(xiàn)程
        Thread thread = new Thread() {
          @Override
          public void run() {
            ContentResolver resolver = getContentResolver();
            ContentValues values = new ContentValues();
            values.put("address", phoneNum);
            values.put("type", 1);
            values.put("date", System.currentTimeMillis());
            values.put("body", textSMS);
            resolver.insert(Uri.parse("content://sms"), values);
          }
        };
        thread.start();
        Toast.makeText(MainActivity.this, "短信成功生成", Toast.LENGTH_SHORT).show();
      }
    });
  }
}

感謝各位的閱讀,以上就是“Android中如何實(shí)現(xiàn)短信編輯器功能”的內(nèi)容了,經(jīng)過(guò)本文的學(xué)習(xí)后,相信大家對(duì)Android中如何實(shí)現(xiàn)短信編輯器功能這一問(wèn)題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,,小編將為大家推送更多相關(guān)知識(shí)點(diǎn)的文章,歡迎關(guān)注!

當(dāng)前標(biāo)題:Android中如何實(shí)現(xiàn)短信編輯器功能-創(chuàng)新互聯(lián)
文章網(wǎng)址:http://aaarwkj.com/article20/dshjco.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供面包屑導(dǎo)航標(biāo)簽優(yōu)化、虛擬主機(jī)、軟件開(kāi)發(fā)網(wǎng)站導(dǎo)航、外貿(mào)網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(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)

外貿(mào)網(wǎng)站制作
免费在线观看污污污网站| 日本中文字幕一区二区视频| 成人亚洲精品一区二区三区| 亚洲第一狼人天堂在线| 视频一区中文字幕在线| 欧美在线日韩一区二区| 99亚洲综合一区二区三区| 精品人妻av中文字幕| 欧美日韩精品成人大片| 四虎最新在线播放视频| 中文字幕乱码av一区二区| 麻豆精品国产免费av影片| 最美是你免费视频观看| 中文字幕精品人妻丝袜| 日本午夜福利视频在线观看| 91伊人激情综合久久| 久久日韩人妻中文字幕| 日韩午夜免费一区二区蜜桃| 18禁超污网站免费观看| 日韩精品中文字幕有码在线 | 欧美亚洲另类在线第一页| 日本熟女视频免费观看| 亚洲av资源一区二区| 人妻艳情一区二区三区| 日本人妻中文字幕在线一区| 熟妇一区二区三区av| 午夜在线精品福利视频| 亚洲国产第一尤物视频| 国产性做爰片免费视频| 国产三级精品正在播放| 欧美日韩精品综合国产| 男女视频一区二区三区在线观看| 亚洲视频在线的视频在| 深夜av一区二区三区| 99精品国产高清一区二区三区| av毛片在线播放免费| 亚洲视频在线视频看视频在线| 亚洲av日韩欧美精品| 漂亮人妻被中出中文字幕| 国语精品对白交换日韩| 免费日本高清色噜噜视频|