Show the action share dialog - Android User Interface

Android examples for User Interface:Dialog

Description

Show the action share dialog

Demo Code


//package com.java2s;

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

public class Main {
    /**//from  w  w  w  . ja  v a2  s.c  o m
     * Show the action share dialog
     *
     * @param context Context
     * @param title   The title that show in share action chooser
     * @param content The content you wanna share
     */
    public static void showTextActionShare(Context context, String title,
            String content) {
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/*").putExtra(Intent.EXTRA_TEXT, content);
        Intent choose = Intent.createChooser(intent, title);
        context.startActivity(choose);
    }
}

Related Tutorials