Example usage for android.content Intent ACTION_SEND

List of usage examples for android.content Intent ACTION_SEND

Introduction

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

Prototype

String ACTION_SEND

To view the source code for android.content Intent ACTION_SEND.

Click Source Link

Document

Activity Action: Deliver some data to someone else.

Usage

From source file:au.com.infiniterecursion.vidiom.utils.PublishingUtils.java

public void launchEmailIntentWithCurrentVideo(final Activity activity,
        final String latestVideoFile_absolutepath) {
    Log.d(TAG, "launchEmailIntentWithCurrentVideo starting");

    Intent i = new Intent(Intent.ACTION_SEND);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    // XXX hardcoded video mimetype
    i.setType("video/mp4");
    i.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + latestVideoFile_absolutepath));
    activity.startActivity(i);/*from w  w  w .  j  a va  2s . c om*/
}

From source file:com.android.gallery3d.filtershow.FilterShowActivity.java

private Intent getDefaultShareIntent() {
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    intent.setType(SharedImageProvider.MIME_TYPE);
    mSharedOutputFile = SaveImage.getNewFile(this, MasterImage.getImage().getUri());
    Uri uri = Uri.withAppendedPath(SharedImageProvider.CONTENT_URI,
            Uri.encode(mSharedOutputFile.getAbsolutePath()));
    intent.putExtra(Intent.EXTRA_STREAM, uri);
    return intent;
}

From source file:com.apps.gator.DisplayTranslationActivity.java

/**
 * Sends an email with a subject of Feedback.
 *///from ww w .  j  ava  2s  . c o m
private void openFeedback() {
    final Intent email = new Intent(Intent.ACTION_SEND);
    email.setType("text/email");
    email.putExtra(Intent.EXTRA_EMAIL, new String[] { "sudhirayrota@gmail.com" });
    email.putExtra(Intent.EXTRA_SUBJECT, "Feedback:Gator Translator:");
    email.putExtra(Intent.EXTRA_TEXT, "Dear Gator-Translator Development Team," + "");
    startActivity(Intent.createChooser(email, "Send Feedback:"));

}

From source file:com.apps.gator.DisplayTranslationActivity.java

/**
 * Sends an email with a subject of Report Error.
 *//* w  ww. ja v a2  s .  c o  m*/
private void openReportError() {
    final Intent email = new Intent(Intent.ACTION_SEND);
    email.setType("text/email");
    email.putExtra(Intent.EXTRA_EMAIL, new String[] { "sudhirayrota@gmail.com" });
    email.putExtra(Intent.EXTRA_SUBJECT, "Report Error:Gator Translator:");
    email.putExtra(Intent.EXTRA_TEXT, "Dear Gator-Translator Development Team," + "");
    startActivity(Intent.createChooser(email, "Report Error:"));
}

From source file:com.odoo.core.orm.OModel.java

public void exportDB() {
    FileChannel source;/* ww  w .  j a  v  a 2s.  c  om*/
    FileChannel destination;
    String currentDBPath = getDatabaseLocalPath();
    String backupDBPath = OStorageUtils.getDirectoryPath("file") + "/" + getDatabaseName();
    File currentDB = new File(currentDBPath);
    File backupDB = new File(backupDBPath);
    try {
        source = new FileInputStream(currentDB).getChannel();
        destination = new FileOutputStream(backupDB).getChannel();
        destination.transferFrom(source, 0, source.size());
        source.close();
        destination.close();
        String subject = "Database Export: " + getDatabaseName();
        Uri uri = Uri.fromFile(backupDB);
        Intent intent = new Intent(Intent.ACTION_SEND);
        intent.putExtra(Intent.EXTRA_STREAM, uri);
        intent.putExtra(Intent.EXTRA_SUBJECT, subject);
        intent.setType("message/rfc822");
        mContext.startActivity(intent);
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:com.android.gallery3d.app.PhotoPage.java

private static Intent createShareIntent(MediaObject mediaObject) {
    int type = mediaObject.getMediaType();
    return new Intent(Intent.ACTION_SEND).setType(MenuExecutor.getMimeType(type))
            .putExtra(Intent.EXTRA_STREAM, mediaObject.getContentUri())
            .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
}

From source file:com.android.gallery3d.app.PhotoPage.java

private static Intent createSharePanoramaIntent(Uri contentUri) {
    return new Intent(Intent.ACTION_SEND).setType(GalleryUtils.MIME_TYPE_PANORAMA360)
            .putExtra(Intent.EXTRA_STREAM, contentUri).addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
}

From source file:com.dvdprime.mobile.android.ui.DocumentViewActivity.java

private Response.Listener<JSONObject> createShortenerReqSuccessListener() {
    return new Response.Listener<JSONObject>() {
        public void onResponse(JSONObject result) {
            try {
                Intent intent = new Intent(Intent.ACTION_SEND);
                intent.setType("text/plain");
                intent.putExtra(Intent.EXTRA_SUBJECT, getSupportActionBar().getSubtitle());
                Object[] data = new Object[2];
                data[0] = getSupportActionBar().getSubtitle();
                data[1] = result.getString("id");
                intent.putExtra(Intent.EXTRA_TEXT, StringUtil.format("[DP]{0} - {1}", data));
                startActivity(Intent.createChooser(intent, getString(R.string.action_bar_share_with)));
                return;
            } catch (JSONException localJSONException) {
                LOGD(TAG, "Parse error");
            }//from  w  ww.j a v a 2s . com
        }
    };
}

From source file:com.andrewshu.android.reddit.threads.ThreadsListActivity.java

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterView.AdapterContextMenuInfo info;
    info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();

    ThingInfo _item = mThreadsAdapter.getItem(info.position);

    switch (item.getItemId()) {
    case Constants.VIEW_SUBREDDIT_CONTEXT_ITEM:
        new MyDownloadThreadsTask(_item.getSubreddit()).execute();
        return true;

    case Constants.SHARE_CONTEXT_ITEM:
        Intent intent = new Intent();
        intent.setAction(Intent.ACTION_SEND);
        intent.setType("text/plain");
        intent.putExtra(Intent.EXTRA_TEXT, _item.getUrl());
        try {/*w  w  w. j  a  v  a2  s . c  o m*/
            startActivity(Intent.createChooser(intent, "Share Link"));
        } catch (android.content.ActivityNotFoundException ex) {
            if (Constants.LOGGING)
                Log.e(TAG, "Share Link", ex);
        }
        return true;

    case Constants.OPEN_IN_BROWSER_CONTEXT_ITEM:
        setLinkClicked(_item);
        Common.launchBrowser(this, _item.getUrl(), Util.createThreadUri(_item).toString(), false, true, true,
                mSettings.isSaveHistory());
        return true;

    case Constants.SAVE_CONTEXT_ITEM:
        new SaveTask(true, _item, mSettings, getApplicationContext()).execute();
        return true;

    case Constants.UNSAVE_CONTEXT_ITEM:
        new SaveTask(false, _item, mSettings, getApplicationContext()).execute();
        return true;

    case Constants.HIDE_CONTEXT_ITEM:
        new MyHideTask(true, _item, mSettings, getApplicationContext()).execute();
        return true;

    case Constants.UNHIDE_CONTEXT_ITEM:
        new MyHideTask(false, _item, mSettings, getApplicationContext()).execute();

    case Constants.DIALOG_VIEW_PROFILE:
        Intent i = new Intent(this, ProfileActivity.class);
        i.setData(Util.createProfileUri(_item.getAuthor()));
        startActivity(i);
        return true;

    default:
        return super.onContextItemSelected(item);
    }

}

From source file:com.mibr.android.intelligentreminder.INeedToo.java

public void TrialIsEndingWarningOrLicensingFailed(String verbiage, Boolean wereDealingWithLicensingHere) {
    final Boolean wdwlh = wereDealingWithLicensingHere;
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(verbiage).setCancelable(false)
            .setNeutralButton(R.string.msg_cus, new DialogInterface.OnClickListener() {
                @Override//from w  w  w .  j a v a 2  s  . c o m
                public void onClick(DialogInterface dialog, int id) {
                    String[] mailto = { "diamondsoftware222@gmail.com", "" };
                    Intent sendIntent = new Intent(Intent.ACTION_SEND);
                    sendIntent.putExtra(Intent.EXTRA_EMAIL, mailto);
                    sendIntent.putExtra(Intent.EXTRA_SUBJECT, "".toString());
                    sendIntent.putExtra(Intent.EXTRA_TEXT, "".toString());
                    sendIntent.setType("text/plain");
                    startActivity(Intent.createChooser(sendIntent, "Send EMail..."));
                }
            }).setPositiveButton(R.string.msg_register, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int id) {
                    Intent i4 = new Intent(INeedToo.this, INeedToPay.class);
                    startActivity(i4);
                }
            }).setNegativeButton(R.string.msg_cancel, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    if (wdwlh) {
                        INeedToo.this.finish();
                    }
                }
            });
    AlertDialog alert = builder.create();
    try {
        alert.show();
    } catch (Exception ee33) {
        int bkhere = 3;
        int bkhere2 = bkhere;
    }
}