Example usage for android.content Intent resolveActivity

List of usage examples for android.content Intent resolveActivity

Introduction

In this page you can find the example usage for android.content Intent resolveActivity.

Prototype

public ComponentName resolveActivity(@NonNull PackageManager pm) 

Source Link

Document

Return the Activity component that should be used to handle this intent.

Usage

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View facebook messenger conversation/*from  w  w  w  .  j a va2 s  . c o m*/
 *
 * @param activity context
 * @param userId   fb messenger user id
 */
public static void launchFBMessengerIntent(Activity activity, String userId) {
    StringBuilder sb = new StringBuilder("fb://messaging/").append(userId);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString()));

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View Github profile/*from  w w w . j a  v  a 2  s.  co m*/
 *
 * @param activity context
 * @param userId   github user id
 */
public static void launchGithubIntent(Activity activity, String userId) {
    StringBuilder sb = new StringBuilder("https:github.com/").append(userId);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString()));

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View google plus profile// w ww. ja  va2 s  . c  om
 *
 * @param activity context
 * @param userId   plus user id
 */
public static void launchGooglePlusIntent(Activity activity, String userId) {
    StringBuilder sb = new StringBuilder("https://plus.google.com/").append(userId).append("/posts");
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString()));

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View Instagram profile/*  w w  w .  j  a  va 2 s . c  om*/
 *
 * @param activity context
 * @param userId   instagram user id
 */
public static void launchInstagramIntent(Activity activity, String userId) {
    StringBuilder sb = new StringBuilder("https:instagram.com/_u/").append(userId);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString()));

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View Linked In profile/*from w  ww  .ja v  a2  s  .com*/
 *
 * @param activity context
 * @param userId   linkedin user id
 */
public static void launchLinkedInIntent(Activity activity, String userId) {
    StringBuilder sb = new StringBuilder("https:linkedin.com/in/").append(userId);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString()));

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View Medium profile/*from  ww  w .  ja v a  2s.c  o  m*/
 *
 * @param activity context
 * @param userId   medium user id
 */
public static void launchMediumIntent(Activity activity, String userId) {
    StringBuilder sb = new StringBuilder("https:medium.com/@").append(userId);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString()));

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View Meerkat profile/*from w  w w. j a  v a 2 s  .  c o  m*/
 *
 * @param activity context
 * @param userId   user profile ID
 */
public static void launchMeerkatIntent(Activity activity, String userId) {
    StringBuilder sb = new StringBuilder("https://meerkatapp.co/").append(userId);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString()));

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View Reddit profile or subreddit/*  w w  w .  j  a  va2  s .  c o m*/
 *
 * @param activity      context
 * @param actionAddress endpoint
 */
public static void launchRedditIntent(Activity activity, String actionAddress) {
    StringBuilder sb = new StringBuilder("https://reddit.com").append(actionAddress);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString()));

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View SnapChant profile//www  . java 2  s  .c o m
 *
 * @param activity      context
 * @param actionAddress location
 */
public static void launchSnapChatIntent(Activity activity, String actionAddress) {
    StringBuilder sb = new StringBuilder("http:snapchat.com/add/").append(actionAddress);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString()));

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View SoundCloud profile/*from   w w  w .  j  a v a 2s . com*/
 *
 * @param activity context
 * @param userId   soundcloud user id
 */
public static void launchSoundCloudIntent(Activity activity, String userId) {
    StringBuilder sb = new StringBuilder("http:soundcloud.com/").append(userId);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString()));

    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    }
}