List of usage examples for android.content Intent createChooser
public static Intent createChooser(Intent target, CharSequence title)
From source file:Main.java
/** * Opens the device's browser to the passed url * @param activity the calling activity//from w ww. jav a2s . c om * @param url the url to view */ public static void openBrowser(Activity activity, String url) { final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); activity.startActivity(Intent.createChooser(browserIntent, null)); }
From source file:Main.java
public static void openLink(Activity activity, String url) { if (url == null) return;//from ww w . j av a2 s.com if (!url.startsWith("http://") && !url.startsWith("https://")) url = "http://" + url; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); intent = Intent.createChooser(intent, null); activity.startActivity(intent); }
From source file:Main.java
public static void sharePic(Uri uri, String desc, Context context) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); shareIntent.setType("image/jpeg"); context.startActivity(Intent.createChooser(shareIntent, desc)); }
From source file:Main.java
public static boolean share(Context context, String title, String content) { Intent send = new Intent(Intent.ACTION_SEND); send.setType("text/plain"); send.putExtra(Intent.EXTRA_TEXT, content); send.putExtra(Intent.EXTRA_SUBJECT, title); try {// www. ja va 2 s. c om context.startActivity(Intent.createChooser(send, content)); } catch (android.content.ActivityNotFoundException ex) { return false; } return true; }
From source file:Main.java
public static Intent buildVideoIntent(Context context, Uri uri) { String title = "Choose photo"; //Build galleryIntent Intent galleryIntent = new Intent(Intent.ACTION_PICK); galleryIntent.setType("video/*"); //Create chooser Intent chooser = Intent.createChooser(galleryIntent, title); Intent cameraIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri); Intent[] extraIntents = { cameraIntent }; chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, extraIntents); return chooser; }
From source file:Main.java
public static Intent getAndroidShareIntent(CharSequence chooseTitle, CharSequence subject, CharSequence content) {//from ww w . j av a 2 s . c o m Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, content); return Intent.createChooser(shareIntent, chooseTitle); }
From source file:Main.java
public static void shareContent(Context context, String subject, String summary, String url) { Intent intent = new Intent(android.content.Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, url); context.startActivity(Intent.createChooser(intent, "Share")); }
From source file:Main.java
public static void shareViaEmail(Context context, String subject, String text) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setType("text/html"); intent.setData(Uri.parse("mailto:")); intent.putExtra(Intent.EXTRA_TEXT, text); intent.putExtra(Intent.EXTRA_SUBJECT, subject); context.startActivity(Intent.createChooser(intent, "Share via Email")); }
From source file:Main.java
public static void sendStringByMail(Context c, String string) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("plain/text"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "DROIDSHEEP DEBUG INFORMATION"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, string); c.startActivity(Intent.createChooser(emailIntent, "Send mail...")); }
From source file:Main.java
public static void share(Context context, String imageFileLocation, String textToSend) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("image/*"); intent.putExtra(Intent.EXTRA_TEXT, textToSend); intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imageFileLocation))); context.startActivity(Intent.createChooser(intent, "Share with...")); }