Code example for ShareActionProvider

Methods: setShareIntent

0
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_SUBJECT, label);
        intent.putExtra(Intent.EXTRA_TEXT, text);
        ShareActionProvider provider = (ShareActionProvider) shareItem.getActionProvider();
        provider.setShareIntent(intent);
    } 
 
    public static void showAddSubredditDialog(FragmentManager fm, String subreddit) {
        AddSubredditFragment.newInstance(subreddit).show(fm, AddSubredditFragment.TAG);
    } 
 
    public static void startAccountListActivity(Context context) {
        context.startActivity(new Intent(context, AccountListActivity.class));
    } 
 
    public static void startAddAccountActivity(Context context) {
        Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
        intent.putExtra(Settings.EXTRA_AUTHORITIES, AUTHORITIES);
        context.startActivity(intent);
    }