use of android.support.v4.app.ShareCompat.IntentBuilder in project SeriesGuide by UweTrottmann.
the class ShareUtils method startShareIntentChooser.
/**
* Share a text snippet. Displays a share intent chooser with the given title, share type is
* text/plain.
*/
public static void startShareIntentChooser(Activity activity, String message, @StringRes int titleResId) {
IntentBuilder ib = ShareCompat.IntentBuilder.from(activity);
ib.setText(message);
ib.setChooserTitle(titleResId);
ib.setType("text/plain");
try {
ib.startChooser();
} catch (ActivityNotFoundException e) {
// no activity available to handle the intent
Toast.makeText(activity, R.string.app_not_available, Toast.LENGTH_LONG).show();
}
}
Aggregations