Example usage for android.app Activity getPackageManager

List of usage examples for android.app Activity getPackageManager

Introduction

In this page you can find the example usage for android.app Activity getPackageManager.

Prototype

@Override
    public PackageManager getPackageManager() 

Source Link

Usage

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View Youtube profile/*from  w  w  w  . j  av a2s .  c  o  m*/
 *
 * @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

/**
 * Launch a general web link.//from www . j av  a 2 s  .  co m
 *
 * @param activity context
 * @param address  http address
 */
public static void launchWebIntent(Activity activity, String address) {
    StringBuilder sb = new StringBuilder("http:").append(address);
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString()));
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    if (intent.resolveActivity(activity.getPackageManager()) != null) {
        activity.startActivity(intent);
    } else {
        Toast.makeText(activity, "Invalid link", Toast.LENGTH_LONG).show();
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View Ello profile/*  w w  w.  j  a  v  a2 s  .  c om*/
 *
 * @param activity context
 * @param userId   ello user id
 */
public static void launchElloIntent(Activity activity, String userId) {
    StringBuilder sb = new StringBuilder("https:ello.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 facebook messenger conversation//from  w w  w .j av  a  2 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 Venmo profile/*from   w w  w . j a  v a 2s  .  com*/
 *
 * @param activity context
 * @param userId   venmo user id
 */
public static void launchVenmoIntent(Activity activity, String userId) {
    StringBuilder sb = new StringBuilder("https:venmo.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 Github profile//from ww  w. j  a  v a  2 s  .com
 *
 * @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 Medium profile/*w w  w .ja  va 2 s.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 SoundCloud profile/* w  ww  . jav a 2 s  .  co m*/
 *
 * @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);
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * View Linked In profile/*from  ww  w.  ja va  2 s. c o m*/
 *
 * @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 Meerkat profile/*w  ww  . ja  va2 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);
    }
}