open SMS via Intent and set SMS message - Android Intent

Android examples for Intent:SMS Send

Description

open SMS via Intent and set SMS message

Demo Code


//package com.java2s;

import android.content.Context;
import android.content.Intent;

import android.net.Uri;

public class Main {
    public static void openSMS(Context context, String smsBody, String tel) {
        Uri uri = Uri.parse("smsto:" + tel);
        Intent it = new Intent(Intent.ACTION_SENDTO, uri);
        it.putExtra("sms_body", smsBody);
        context.startActivity(it);/*from   www.  j a v a 2 s .co  m*/
    }
}

Related Tutorials