Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

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

import android.net.Uri;
import android.text.TextUtils;

public class Main {

    public static void callSystemSmsMsg(Context context, String content) {
        callSystemSmsAction(context, null, content);
    }

    public static void callSystemSmsAction(Context context, String phone, String content) {
        Uri uri = Uri.parse("smsto:" + (TextUtils.isEmpty(phone) ? "" : phone));
        Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
        intent.putExtra("sms_body", TextUtils.isEmpty(content) ? "" : content);
        context.startActivity(intent);
    }
}