显示电子邮件后吐司android系统中发送? [英] Show Toast after email send in android?

查看:120
本文介绍了显示电子邮件后吐司android系统中发送?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是低于code发送邮件

I am using the below code to send the mail

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL, new String[] { "abc@yahoo.com" });
i.putExtra(Intent.EXTRA_CC, new String[] { bcc_string });
i.putExtra(Intent.EXTRA_SUBJECT, "Video Suggest");
i.putExtra(Intent.EXTRA_TEXT, url_link); 

try {
   startActivityForResult(Intent.createChooser(i, "Send Mail..."), 1);
} catch (android.content.ActivityNotFoundException ex) {
   Toast.makeText(AllVideos.this, "There are no email clients installed.", Toast.LENGTH_SHORT)
   .show();
}

在我上的活动结果我用下面的code

and in my on activity result i am using the following code

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    // System.out.println("inactivity");
    // Toast.makeText(AllVideos.this, "Mail Send", 10).show();

    System.out.println("inside activity result");

    if (requestCode == 1) {
        if (requestCode == 1 && resultCode == RESULT_OK) {
            Toast.makeText(this, "Mail sent.", Toast.LENGTH_SHORT).show();

        } else if (requestCode == 1 && resultCode == RESULT_CANCELED) {
            Toast.makeText(this, "Mail canceled.", Toast.LENGTH_SHORT)
                    .show();
        } else {
            Toast.makeText(this, "Plz try again.", Toast.LENGTH_SHORT)
                    .show();
        }
    }
}

但每次我发送或丢弃这个消息我收到邮件取消举杯。
请帮我把这个问题。

But everytime i send or discard the message i get "mail cancelled" toast. Please help me put with this.

先谢谢了。

推荐答案

按<一个href=\"http://stackoverflow.com/questions/3778048/how-can-we-use-startactivityforresult-for-email-intent\">link

您不能,这不是API的一部分。它返回一旦你有
   pressed发送按钮,即使不发送它

You can't, this is not part of the API. It returns once you have pressed send button even if it is not sent

ACTION_SEND没有任何的输出结果,你总是得到RESULT_CANCELED默认值。

ACTION_SEND does NOT have any output as a result you always get the default value which is RESULT_CANCELED.

你也可以不与意向数据回来检查它,因为它总是空
   无论是邮件发送或丢弃。

Also you can NOT check it with Intent data coming back because it is always null either mail send or discard.

这篇关于显示电子邮件后吐司android系统中发送?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆