List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
public static void installApk(Context context, File apkFile) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static boolean showMap(Context context, String address) { Uri addressUri = Uri.parse("geo:0,0?q=" + address); Intent searchAddress = new Intent(Intent.ACTION_VIEW, addressUri); boolean ret = true; try {/*from w ww. j av a 2 s.c o m*/ context.startActivity(searchAddress); } catch (Exception e) { ret = false; } return ret; }
From source file:Main.java
public static void install(Context context, File uriFile) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(uriFile), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void uninstall(Context context, String packageName) { Uri packageURI = Uri.parse("package:" + packageName); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); uninstallIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(uninstallIntent); }
From source file:Main.java
public static void uninstallSoftware(Context context, String packageName) { Uri packageURI = Uri.parse("package:" + packageName); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); uninstallIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(uninstallIntent); }
From source file:Main.java
public static void jumpToSystemShareText(Context context, String content) { Intent sendIntent = new Intent(); sendIntent.setAction("android.intent.action.SEND"); sendIntent.putExtra("android.intent.extra.TEXT", content); sendIntent.setType("text/plain"); context.startActivity(sendIntent); }
From source file:Main.java
public static void launchWeb(Context activityContext, String url) { //Log.d(TAG, "launchWeb::"+url); Intent in = new Intent(); in.setAction(Intent.ACTION_VIEW);//from w w w . j a v a 2s .com in.addCategory(Intent.CATEGORY_BROWSABLE); in.setData(Uri.parse(url)); activityContext.startActivity(in); }
From source file:Main.java
public static void installApp(Context context, String path) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.parse("file://" + path), "application/vnd.android.package-archive"); context.startActivity(intent); }
From source file:Main.java
public static void install(Context context, String url) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.fromFile(new File(url)), "application/vnd.android.package-archive"); context.startActivity(intent); }
From source file:Main.java
public static void openUrl(Context c, String url) { Uri uri = Uri.parse(url);/*from ww w. j av a2s . c o m*/ Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.putExtra(Browser.EXTRA_APPLICATION_ID, c.getPackageName()); checkContextIsActivity(c, intent); c.startActivity(intent); }