send SMS Message via Intent - Android Phone

Android examples for Phone:SMS

Description

send SMS Message via Intent

Demo Code


//package com.java2s;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public class Main {

    public static void sendMessage(Context context, String phoneNum,
            String content) {//from w w w  .ja v a2  s . c om
        Intent intent = new Intent(Intent.ACTION_SENDTO);
        Uri uri = Uri.parse("smsto:" + phoneNum);
        intent.setData(uri);
        intent.putExtra("sms_body", content);
        context.startActivity(intent);
    }
}

Related Tutorials