- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有以下代码启动发送电子邮件消息的 Intent
@Override
public void onPostExecute(File outfile) {
ProgressDialogRequestIcons d1 = (ProgressDialogRequestIcons) fm.findFragmentByTag("DIALOG_F2");
d1.dialogDismiss();
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
Uri uri = Uri.fromFile(outfile);
intent.putExtra(Intent.EXTRA_STREAM, uri);
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { getString(R.string.app_email) });
intent.putExtra(Intent.EXTRA_SUBJECT, "Icon Support for" + " " + this.getResources().getString(R.string.app_name));
intent.putExtra(Intent.EXTRA_TEXT, "I am using " + Build.DEVICE + " with Android version " + Build.VERSION.RELEASE);
this.startActivity(Intent.createChooser(intent, "Send eMail.."));
}
然而,当弹出对话框选择要发送的应用程序时,它显示没有像这样的图标
然后我尝试了如下的另一种方法,但仍然有同样的问题。
public void startEmailIntentWithPackage(File icon_request){
try{
ShareCompat.IntentBuilder.from(this)
.setType("application/zip")
.addStream(Uri.parse("file://" + icon_request.getAbsolutePath()))
.addEmailTo(getString(R.string.app_email))
.setSubject("Icon Support for" + " " + this.getResources().getString(R.string.app_name))
.setText("I am using " + Build.DEVICE + " with Android version " + Build.VERSION.RELEASE)
.setChooserTitle("Send Email..")
.startChooser();
}
catch (Exception ignored)
{
}
}
最佳答案
AsyncTask
的一个烦恼是默认情况下返回序列化执行,这在 API 级别 13 中正式开始。当库在内部使用 AsyncTask
时,情况会变得更糟...并且自己不使用 executeOnExecutor()
选择加入线程池。
我的猜测是:
execute()
启动了一个任务ShareCompat
使用 execute()
启动另一个任务...然后阻塞直到第一个任务完成解决方案是:
executeOnExecutor()
,或者Thread
,特别是当您不需要 onPostExecute()
或 onProgressUpdate()
fragment 时 AsyncTask
关于android - Intent.Action_Send 和 ShareCompat.IntentBuilder 对话框缺少应用程序图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22333447/
当我尝试使用 ShareCompat 共享 my_file.html 时,遇到一个奇怪的问题。作为最佳实践,我创建了自己的 FileProvider,但收到错误 java.lang.IllegalAr
我的问题是如何在 android 中使用 ShareCompat intentBuilder 共享多个文件。 我的代码抛出异常: android.content.ActivityNotFoundExc
我正在尝试使用 ShareCompat.IntentBuilder 通过电子邮件应用程序共享文本, 但 HTML 标签(例如 Some text )会被忽略。它显示纯文本。 final String
我正在使用 ShareCompat.IntentBuilder 发送带有附件的电子邮件。 除了我要附加的文件的 uri 会自动添加到收件人之外,我对附加文件没有任何问题。 自己看: 这是我用来发送电子
在我的应用程序中,我使用 SharCompat 获取我想要共享内容的应用程序列表。我在列表中有 twitter 应用程序。当我进入设备中的 Twitter 应用程序时。我遇到了以下异常。 要打开共享内
我正在尝试添加共享 Intent 以发布到 Google Plus,但似乎无法解决传递新的 ShareCompat.IntentBuilder 的问题(Android 支持库类)到 startActi
我想为我的应用程序小部件 View 创建一个待定 Intent ,它将启动一个共享 Intent 。问题是没有引用 android.appwidget.AppWidgetProvider 类中的任何
我有以下代码启动发送电子邮件消息的 Intent @Override public void onPostExecute(File outfile) { ProgressDialogReque
我是一名优秀的程序员,十分优秀!