List of usage examples for android.content Intent resolveActivity
public ComponentName resolveActivity(@NonNull PackageManager pm)
From source file:com.shareyourproxy.IntentLauncher.java
/** * View Spotify profile/* ww w. jav a 2 s . c o m*/ * * @param activity context * @param actionAddress user endpoint */ public static void launchSpotifyIntent(Activity activity, String actionAddress) { StringBuilder sb = new StringBuilder("spotify:user:").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
/** * Launch a steam profile link./*from w w w.jav a 2 s . c o m*/ * * @param activity context * @param address http address */ public static void launchSteamIntent(Activity activity, String address) { StringBuilder sb = new StringBuilder("http:steamcommunity.com/id/").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 Venmo profile//from w w w . j a v a2s. c o m * * @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
/** * Launch a general web link./*from w w w.j a v a 2 s. c o 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
/** * Launch a lol profile link./*from ww w . j a v a 2 s.c o m*/ * * @param activity context * @param address address */ public static void launchLeagueOfLegendsIntent(Activity activity, String address) { StringBuilder sb = new StringBuilder("http:boards.na.leagueoflegends.com/en/player/NA/").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 Twitter profile/*ww w . ja v a2 s.c o m*/ * * @param activity context * @param userId user profile ID */ public static void launchTwitterIntent(Activity activity, String userId) { StringBuilder sb = new StringBuilder("twitter://user?screen_name=").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) { intent.setData(Uri.parse("https://mobile.twitter.com/" + userId)); } activity.startActivity(intent); }
From source file:com.shareyourproxy.IntentLauncher.java
/** * Launch a nintendo network profile link. * * @param activity context//w w w . j a v a 2 s.c o m * @param address address */ public static void launchNintendoNetworkIntent(Activity activity, String address) { StringBuilder sb = new StringBuilder("http:miiverse.nintendo.net/users/").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
/** * Launch a playstation network profile link. * * @param activity context//from www .j av a 2 s. c om * @param address address */ public static void launchPlaystationNetworkIntent(Activity activity, String address) { StringBuilder sb = new StringBuilder("http:psnprofiles.com/").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
/** * Launch a twitch profile link.//ww w.ja va 2 s . co m * * @param activity context * @param address http address */ public static void launchTwitchIntent(Activity activity, String address) { StringBuilder sb = new StringBuilder("http:www.twitch.tv/").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
/** * Launch a xbox live profile link./*from ww w . ja va2 s . c o m*/ * * @param activity context * @param address http address */ public static void launchXboxLiveIntent(Activity activity, String address) { StringBuilder sb = new StringBuilder("http:live.xbox.com/en-US/Profile?Gamertag=").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(); } }