List of usage examples for android.content Intent setAction
public @NonNull Intent setAction(@Nullable String action)
From source file:Main.java
public static void sendText(Activity context, String text) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); // sendIntent.putExtra(Intent.EXTRA_TEXT, text); // sendIntent.setType("text/plain"); context.startActivity(Intent.createChooser(sendIntent, text)); }
From source file:Main.java
private static void sendActionCommand(Context ctx, String action, Bundle extras) { Intent intent = new Intent(); intent.setAction(action); if (extras != null) { intent.putExtras(extras);//from w ww .ja v a 2 s .c o m } ctx.sendBroadcast(intent); }
From source file:Main.java
public static void sendBroadCast(Context context, String action, Bundle extras) { Intent intent = new Intent(); intent.setAction(action); intent.putExtras(extras);/*from w w w. j a va 2 s . c o m*/ LocalBroadcastManager.getInstance(context).sendBroadcast(intent); }
From source file:Main.java
/** * uninstall app via package name// ww w . jav a2s . c o m * @param context * @param packageName */ public static void uninstallApp(Context context, String packageName) { Uri packageUri = Uri.parse("package:" + packageName); Intent intent = new Intent(); intent.setAction(Intent.ACTION_DELETE); intent.setData(packageUri); context.startActivity(intent); }
From source file:Main.java
/** * @return the List of applications which support Mushroom protocol. */// ww w . j a va 2 s .c o m public static List<ResolveInfo> getMushroomApplicationList(PackageManager packageManager) { Intent intent = new Intent(); intent.setAction(ACTION); intent.addCategory(CATEGORY); return packageManager.queryIntentActivities(intent, 0); }
From source file:Main.java
public static void sendBroadcast(Context context, String action) { Intent broadcast = new Intent(); broadcast.setAction(action); context.sendBroadcast(broadcast);// www. j av a 2 s. co m }
From source file:Main.java
public static void sendBroadCast(Context context, String action, String key, String value) { Intent intent = new Intent(); intent.setAction(action); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra(key, value);//from w w w . j av a2s . co m context.sendBroadcast(intent); }
From source file:Main.java
public static void sendBroadCast(Context context, String action, String key, int value) { Intent intent = new Intent(); intent.setAction(action); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.putExtra(key, value);/*from ww w . j a v a 2s . c o m*/ context.sendBroadcast(intent); }
From source file:Main.java
public static void downApkFromBrowser(Context context, String strUrl) { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri uri = Uri.parse(strUrl);/* w w w . j a v a 2 s . c om*/ intent.setData(uri); context.startActivity(intent); }
From source file:Main.java
public static void startExplorer(Context context, String url) { if (url == null) { return;/*from w w w. j a v a 2 s. c o m*/ } Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse(url); intent.setData(content_url); context.startActivity(intent); }