List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
public static void goToGitHub(Context context) { Uri uriUrl = Uri.parse("http://github.com/jfeinstein10/slidingmenu"); Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl); context.startActivity(launchBrowser); }
From source file:Main.java
public static void startApplication(Context context, String packageName) { PackageManager pm = context.getPackageManager(); Intent intent = pm.getLaunchIntentForPackage(packageName); context.startActivity(intent); }
From source file:Main.java
/** launch market to certain app */ public static void launchMarket(Context context, String packageName) { Uri uri = Uri.parse("market://details?id=" + packageName); Intent iDown = new Intent(Intent.ACTION_VIEW, uri); context.startActivity(iDown); }
From source file:Main.java
public static void playTrailer(Context context, String key) { Intent intent;/*from w ww .j a va 2 s .com*/ try { intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + key)); context.startActivity(intent); } catch (ActivityNotFoundException ex) { intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=" + key)); context.startActivity(intent); } }
From source file:Main.java
public static void toHome(Context context) { Intent i = new Intent(Intent.ACTION_MAIN); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.addCategory(Intent.CATEGORY_HOME); context.startActivity(i); }
From source file:Main.java
static void resolveIntent(Intent intent, Context context) { if (context instanceof Application) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); }//from ww w .j a v a 2s . c o m context.startActivity(intent); }
From source file:Main.java
public static void goToActivity(Context packageContext, Class<?> targetActivityClass) { Intent intent = new Intent(); intent.setClass(packageContext, targetActivityClass); packageContext.startActivity(intent); }
From source file:Main.java
public static void call(Context context, String tel) { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + tel)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void restartApp(Context context) { Intent i = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(i); }
From source file:Main.java
public static void callPhone(Context context, String phone) { Intent intent = new Intent(Intent.ACTION_CALL); Uri data = Uri.parse("tel:" + phone); intent.setData(data);// w w w . jav a2 s. co m context.startActivity(intent); }