We often encounter a situation in our lives. Sometimes a text message is too long to send multiple messages. In fact, it is very easy to achieve this effect, just add a condition to judge, I will not write all the detailed steps here. I will only paste the content in the activity into package CN. csdn; import Java. util. list; import android. app. activity; import android. app. pendingintent; import android. content. intent; import android. OS. bundle; import android. telephony. GSM. smsmanager; import android. view. view; import android. view. view. onclicklistener; import android. widget. button; import android. widget. Edittext; import android. widget. toast; public class sendmessageactivity extends activity implements onclicklistener {/** called when the activity is first created. * // @ override public void oncreate (bundle savedinstancestate) {super. oncreate (savedinstancestate); setcontentview (R. layout. main); // obtain the component button sendbtn = (button) findviewbyid (R. id. send); // register the event sendbtn. setonclicklistener (this);} @ Su Ppresswarnings ("deprecation") @ overridepublic void onclick (view v) {// todo auto-generated method stubedittext user = (edittext) findviewbyid (R. id. user); edittext content = (edittext) findviewbyid (R. id. content); // information management object smsmanager = smsmanager. getdefault (); // The normal intent state of the Request Code represented by the last three parameters: pendingintent intent = pendingintent. getbroadcast (sendmessageactivity. this, 0, new intent (), 0); // if the number of words exceeds 70, you need to split it into multiple text messages Send string con = content. gettext (). tostring (); If (content. length ()> 70) {list <string> msgs = smsmanager. dividemessage (CON); For (string MSG: MSGs) {smsmanager. sendtextmessage (user. gettext (). tostring (), null, MSG, intent, null) ;}} else {smsmanager. sendtextmessage (user. gettext (). tostring (), null, content. gettext (). tostring (), intent, null);} // The message is successfully sent toast. maketext (sendmessageactivity. this, "message sent successfully", toast. length_lon G). Show () ;}}note: I set content. Length () to greater than 4 during the test. When I send a text message, five will be divided into two short messages for sending. Only when the text message content exceeds 70 can two messages be sent. I think it may be that when the dividemessage method is called internally, multiple messages are sent only when the default value is exceeded.