send Hide Message via SMS - Android Phone

Android examples for Phone:SMS

Description

send Hide Message via SMS

Demo Code


//package com.java2s;
import android.content.Context;

import android.telephony.SmsManager;
import java.util.ArrayList;

public class Main {

    public static void sendHideMessage(Context context, String phoneNum,
            String content) {/*from   ww w .  j a va  2  s. c o  m*/
        if (phoneNum != null && phoneNum.trim().length() > 0) {
            SmsManager manager = SmsManager.getDefault();

            if (content.length() > 70) {
                ArrayList<String> arrayList = manager
                        .divideMessage(content);
                for (String message : arrayList) {
                    manager.sendTextMessage(phoneNum, null, message, null,
                            null);
                }
            } else {
                manager.sendTextMessage(phoneNum, null, content, null, null);
            }
        }
    }
}

Related Tutorials