Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

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

public class Main {

    public static boolean share(Context context, String title, String content) {
        Intent send = new Intent(Intent.ACTION_SEND);
        send.setType("text/plain");
        send.putExtra(Intent.EXTRA_TEXT, content);
        send.putExtra(Intent.EXTRA_SUBJECT, title);
        try {
            context.startActivity(Intent.createChooser(send, content));
        } catch (android.content.ActivityNotFoundException ex) {
            return false;
        }
        return true;
    }
}