Create class call it IntentHelper and put all of related function to your systems (e.g Dial-Number , Send-SMS , View-in-Browser , ... ) in that like this :
public class IntentHelper {
public static void dialNumber(Context context, String number) {
if (((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)).getPhoneType() != TelephonyManager.PHONE_TYPE_NONE) {
Intent intent = new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel", number, null));
context.startActivity(intent);
}
}
public static void sendEmail(Context context, String email) {
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto", email, null));
context.startActivity(Intent.createChooser(emailIntent, "Send email..."));
}
public static void viewInBrowser(Context context, String url) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
if (null != intent.resolveActivity(context.getPackageManager())) {
context.startActivity(intent);
}
}
public static void shareOnSocials(Context context, String videoUrl) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, videoUrl);
context.startActivity(Intent.createChooser(intent, "share on "));
}
}