List of usage examples for android.content Intent resolveActivity
public ComponentName resolveActivity(@NonNull PackageManager pm)
From source file:org.alfresco.mobile.android.application.fragments.user.UserProfileFragment.java
public static void actionCall(FragmentActivity activity, String number) { try {/*from w w w. j a v a 2s .c o m*/ Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + number)); if (intent.resolveActivity(activity.getPackageManager()) == null) { AlfrescoNotificationManager.getInstance(activity).showAlertCrouton((FragmentActivity) activity, activity.getString(R.string.feature_disable)); return; } activity.startActivity(intent); } catch (ActivityNotFoundException e) { } }
From source file:org.alfresco.mobile.android.application.managers.ActionUtils.java
public static void actionSend(FragmentActivity activity, File contentFile, String mimetype) { try {//from w ww.j a v a2 s. com Intent i = new Intent(Intent.ACTION_SEND); i.putExtra(Intent.EXTRA_SUBJECT, contentFile.getName()); i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(contentFile)); i.setType((TextUtils.isEmpty(mimetype)) ? MimeTypeManager.getInstance(activity).getMIMEType(contentFile.getName()) : mimetype); if (i.resolveActivity(activity.getPackageManager()) == null) { AlfrescoNotificationManager.getInstance(activity).showAlertCrouton(activity, activity.getString(R.string.feature_disable)); return; } activity.startActivity(Intent.createChooser(i, activity.getText(R.string.share_content))); } catch (ActivityNotFoundException e) { AlfrescoNotificationManager.getInstance(activity).showAlertCrouton(activity, R.string.error_unable_share_content); } }
From source file:com.shareyourproxy.IntentLauncher.java
/** * View yo profile/* www. j a va 2s.c om*/ * * @param activity context * @param username yo username */ public static void launchYoIntent(Activity activity, String username) { Intent intent = new Intent(); intent.setData(Uri.parse("yo:add:" + username)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } }
From source file:com.shareyourproxy.IntentLauncher.java
/** * View skype profile//from ww w .j av a2s . c o m * * @param activity context * @param username skype username */ public static void launchSkypeIntent(Activity activity, String username) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("skype:" + username)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } }
From source file:com.shareyourproxy.IntentLauncher.java
/** * Launch the Dialer App.//w w w . j a va 2 s . c o m * * @param activity context * @param phoneNumber to dial */ public static void launchPhoneIntent(Activity activity, String phoneNumber) { Intent intent = new Intent(Intent.ACTION_DIAL); intent.setData(Uri.parse("tel:" + phoneNumber)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } }
From source file:com.shareyourproxy.IntentLauncher.java
/** * Send SMS to phone number./*from w ww. ja v a2 s.c om*/ * * @param activity context * @param phoneNumber to sms */ public static void launchSMSIntent(Activity activity, String phoneNumber) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("smsto:" + phoneNumber)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } }
From source file:com.shareyourproxy.IntentLauncher.java
/** * View Youtube profile/* w w w . j av a 2 s.c om*/ * * @param activity context * @param userId youtube user id */ public static void launchYoutubeIntent(Activity activity, String userId) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("http://www.youtube.com/user/" + userId)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } }
From source file:com.shareyourproxy.IntentLauncher.java
/** * View facebook help page.// w w w . j a v a 2s .c om * * @param activity context */ public static void launchFacebookHelpIntent(Activity activity) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("http:www.facebook.com/help/211813265517027")); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } }
From source file:com.shareyourproxy.IntentLauncher.java
/** * Send SMS to phone number on Hangouts. * * @param activity context// w ww . ja v a 2 s. c o m * @param actionAddress to contactId */ public static void launchHangoutsIntent(Activity activity, String actionAddress) { StringBuilder sb = new StringBuilder("content://com.android.contacts/data/").append(actionAddress); Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse(sb.toString())); intent.setPackage("com.google.android.talk"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (intent.resolveActivity(activity.getPackageManager()) != null) { activity.startActivity(intent); } }
From source file:org.alfresco.mobile.android.application.fragments.user.UserProfileFragment.java
public static void actionStartIm(FragmentActivity activity, String personId) { Uri imUri = new Uri.Builder().scheme("imto").authority("gtalk").appendPath(personId).build(); Intent intent = new Intent(Intent.ACTION_SENDTO, imUri); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try {/*from w ww . j a v a2 s . c o m*/ if (intent.resolveActivity(activity.getPackageManager()) == null) { AlfrescoNotificationManager.getInstance(activity).showAlertCrouton((FragmentActivity) activity, activity.getString(R.string.feature_disable)); return; } activity.startActivity(intent); } catch (ActivityNotFoundException e) { } }