List of usage examples for android.content Context startActivity
public abstract void startActivity(@RequiresPermission Intent intent);
From source file:Main.java
public static void startActivity(Context context, Intent intent) { if (context instanceof Activity) { startActivity((Activity) context, intent, -1); } else {//from w ww . ja v a2 s . com context.startActivity(intent); } }
From source file:Main.java
public static void Unintall(Context context, String packname) { Uri packageURI = Uri.parse("package:" + packname); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); context.startActivity(uninstallIntent); }
From source file:Main.java
public static void openWebSite(Context context, String url) { Uri uri = Uri.parse(url);/* w ww . j av a2 s .co m*/ Intent it = new Intent(Intent.ACTION_VIEW, uri); it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(it); }
From source file:Main.java
public static void uninstall(Context context, String packageName) { Uri uri = Uri.fromParts("package", packageName, null); Intent it = new Intent(Intent.ACTION_DELETE, uri); context.startActivity(it); }
From source file:Main.java
public static void shareAppInfo(Context context, String info) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, info); context.startActivity(intent); }
From source file:Main.java
public static void callPhone(Context context, String phoneNum) { Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phoneNum)); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void uninstallAPK(Context ctx, String packageName) { Uri packageURI = Uri.parse("package:" + packageName); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); ctx.startActivity(uninstallIntent); }
From source file:Main.java
public static void openGallery(Context pContext) { Intent galleryIntent = new Intent(Intent.ACTION_VIEW, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); pContext.startActivity(galleryIntent); }
From source file:Main.java
public static void editMessage(Context context, String msg) { Intent msgIntent = new Intent(); msgIntent.setAction(Intent.ACTION_SENDTO); msgIntent.putExtra("sms_body", msg); context.startActivity(msgIntent); }
From source file:Main.java
public static void showWebPage(String url, Context context) { if (TextUtils.isEmpty(url)) return;/* ww w .ja va 2s. c o m*/ Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); context.startActivity(intent); }