Android uses intent to send SMS to the implementation method _android

Source: Internet
Author: User
Tags sqlite database

This article illustrates how Android uses intent to send text messages. Share to everyone for your reference, specific as follows:

Use intent to send text messages in an activity

 package com.zhuguangwei; import android.app.Activity; import android.content.Intent;
Import Android.net.Uri;
Import Android.os.Bundle;
Import Android.view.View;
Import Android.view.View.OnClickListener;
Import Android.widget.Button;
  public class Intentactivity extends activity {private Button MyButton; /** called the activity is a.
    * * @Override public void onCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);
    Setcontentview (R.layout.main);
    MyButton = (Button) Findviewbyid (R.id.mybutton); Mybutton.setonclicklistener (New Onclicklistener () {@Override public void OnClick (View v) {//TODO Au
        to-generated method Stub//use intent to send SMS URI uri = uri.parse ("smsto:13800000000");
        Intent Intent = new Intent (Intent.action_sendto,uri);
        Intent.putextra ("Sms_body", "The SMS Text");
      StartActivity (Intent);
  }
    }); }
}

More interested readers of Android-related content can view this site: "Android SMS and phone Operation tips Summary", "Android File Operating skills summary", "Android operation SQLite Database Skills Summary", " Android operations JSON format Data tips summary, "Android Database Operation skills Summary", "Android programming activity Operation Skills Summary", "Android programming development of SD card operation method Summary", "Android Development and advanced tutorial , "The Android resource Operation tips Summary", the Android View tips summary, and the "Android Control usage Summary"

I hope this article will help you with the Android program.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.