List of usage examples for android.content Intent setAction
public @NonNull Intent setAction(@Nullable String action)
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);// ww w . j av a 2s. co m }
From source file:Main.java
public static Intent getInstallIntent(File apkFile) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(apkFile.getAbsolutePath())), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return intent; }
From source file:Main.java
public static Intent getShareHtmlIntent(String htmlText) { Intent textIntent = new Intent(); textIntent.setAction(Intent.ACTION_SEND); textIntent.putExtra(Intent.EXTRA_TEXT, "This is html"); textIntent.putExtra(Intent.EXTRA_HTML_TEXT, htmlText); textIntent.setType("text/plain"); return textIntent; }
From source file:Main.java
public static void sendMail(Context context, String email) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { email }); sendIntent.putExtra(Intent.EXTRA_TEXT, ""); sendIntent.setType("text/plain"); context.startActivity(sendIntent);/*from ww w .j av a 2 s . c o m*/ }
From source file:Main.java
public static boolean sendEmailToDeveleper(Activity act) { Intent intent = new Intent(); intent.setAction("android.intent.action.VIEW"); Uri content_url = Uri.parse("https://mail.qq.com"); intent.setData(content_url);/*from w ww . j av a2s .c om*/ act.startActivity(intent); return true; }
From source file:Main.java
public static void Broadcast(String action, Bundle bundle, Context context) { Intent intent = new Intent(); intent.setAction(action); if (bundle != null) { intent.putExtras(bundle);//w w w. j a v a 2 s .c o m } context.sendBroadcast(intent); }
From source file:Main.java
public static void shareImage(Context context, Uri uri, String title) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); shareIntent.setType("image/jpeg"); context.startActivity(Intent.createChooser(shareIntent, title)); }
From source file:Main.java
public static void sendBroadCast(Context context, String action) { Intent intent = new Intent(); intent.setAction(action); LocalBroadcastManager.getInstance(context).sendBroadcast(intent); }
From source file:Main.java
public static void jumpToSystemShareImage(Context context, String imageUri) { Intent shareIntent = new Intent(); shareIntent.setAction("android.intent.action.SEND"); shareIntent.putExtra("android.intent.extra.STREAM", imageUri); shareIntent.setType("image/*"); context.startActivity(shareIntent);/*from w ww .j av a 2s .com*/ }
From source file:Main.java
public static void startShareIntentActivity(Activity activity, String text) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, text); activity.startActivity(intent);//w w w. j a v a 2s . co m }