Example usage for android.content Intent setType

List of usage examples for android.content Intent setType

Introduction

In this page you can find the example usage for android.content Intent setType.

Prototype

public @NonNull Intent setType(@Nullable String type) 

Source Link

Document

Set an explicit MIME data type.

Usage

From source file:Main.java

public static Intent getShareInfoIntent(String info) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    return intent.putExtra(Intent.EXTRA_TEXT, info);
}

From source file:Main.java

public static Intent createShareIntent(String string) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, string);
    return intent;
}

From source file:Main.java

public static Intent createNewEventIntent() {
    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setType(INTENT_TYPE_EVENT);
    return intent;
}

From source file:Main.java

public static Intent getAndroidImageShareIntent(CharSequence chooseTitle, String pathfile) {
    Intent share = new Intent(Intent.ACTION_SEND);
    share.setType("image/*");
    share.putExtra(Intent.EXTRA_STREAM, Uri.parse(pathfile));
    return Intent.createChooser(share, chooseTitle);
}

From source file:Main.java

public static void newMessage(Context context) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setType("vnd.android-dir/mms-sms");
    // intent.putExtra("sms_body", "");
    context.startActivity(intent);/*from  w ww .j  ava  2  s  .co  m*/
}

From source file:Main.java

public static Intent getShareTextIntent(String content) {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.setType("text/plain");
    intent.putExtra(Intent.EXTRA_TEXT, content);
    return intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}

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   ww  w .j a  v a  2s  .c o m
}

From source file:Main.java

public static void turnPhotosWithCrop(Activity mContext, int requestCode) {
    Intent intent = new Intent(Intent.ACTION_PICK);
    intent.setType("image/*");
    intent.putExtra("return-data", true);
    mContext.startActivityForResult(intent, requestCode);
}

From source file:Main.java

public static Intent getPhotoGalleryIntent(Uri photoUri) {
    Intent galleryIntent = new Intent();
    galleryIntent.setType("image/*");
    galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
    addPhotoPickerExtras(galleryIntent, photoUri);
    return galleryIntent;
}

From source file:Main.java

public static Intent makeSystemAlbumIntent() {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    intent.setType("image/*");
    return intent;
}