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.