List of usage examples for android.content Intent setType
public @NonNull Intent setType(@Nullable String type)
From source file:Main.java
public static void choosePicture(Activity activity, int requestCode) { Intent openAlbumIntent = new Intent(Intent.ACTION_GET_CONTENT); openAlbumIntent.setType("image/*"); activity.startActivityForResult(openAlbumIntent, requestCode); }
From source file:Main.java
public static void sendMail(Context context, String[] mail, String subject, String body) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("message/rfc822"); // i.putExtra(Intent.EXTRA_EMAIL , new String[]{"recipient@example.com"}); // i.putExtra(Intent.EXTRA_SUBJECT, "subject of email"); // i.putExtra(Intent.EXTRA_TEXT , "body of email"); i.putExtra(Intent.EXTRA_EMAIL, mail); i.putExtra(Intent.EXTRA_SUBJECT, subject); i.putExtra(Intent.EXTRA_TEXT, body); try {//from w w w . ja v a2 s . co m context.startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(context, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } }
From source file:Main.java
public static void share(Context context, String textToSend) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, textToSend); context.startActivity(Intent.createChooser(intent, "Share with...")); }
From source file:Main.java
public static Intent openAlbum() { Intent intent = new Intent("android.intent.action.GET_CONTENT"); intent.setType("image/*"); return intent; }
From source file:Main.java
public static void pickImage(Activity activity, int requestCode) throws Exception { Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null); intent.setType("image/*"); // intent.putExtra("return-data", true); activity.startActivityForResult(intent, requestCode); }
From source file:Main.java
public static void choosePicture(Activity activity) { Intent openAlbumIntent = new Intent(Intent.ACTION_GET_CONTENT); openAlbumIntent.setType("image/*"); activity.startActivityForResult(openAlbumIntent, CHOOSE_PICTURE); }
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...")); }
From source file:Main.java
public static void shareText(Context context, String title, String text) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, title); intent.putExtra(Intent.EXTRA_TEXT, text); context.startActivity(Intent.createChooser(intent, title)); }
From source file:Main.java
public static Intent pickImage() { final Intent intent = new Intent(Intent.ACTION_PICK); intent.setType(MediaStore.Images.Media.CONTENT_TYPE); return intent; }
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")); }