Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/199.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如果草稿未删除安卓手机短信,则发送图像意图不会更新_Android_Android Intent - Fatal编程技术网

Android 如果草稿未删除安卓手机短信,则发送图像意图不会更新

Android 如果草稿未删除安卓手机短信,则发送图像意图不会更新,android,android-intent,Android,Android Intent,好的,我正在使用ACTION_SEND Intent来共享和镜像。我对我最近所做的工作相当陌生——我正在共享一个位图,它是从一个视图生成的,该视图被保存并传递到Intent中 intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); 无论如何,通过一些基本的测试,我注意到如果你打开选择器,选择say SMS,然后在我将另一个图像共享到SMS时不发送而回击,前一个图像将作为附件出现。附加到S

好的,我正在使用ACTION_SEND Intent来共享和镜像。我对我最近所做的工作相当陌生——我正在共享一个位图,它是从一个视图生成的,该视图被保存并传递到Intent中

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
无论如何,通过一些基本的测试,我注意到如果你打开选择器,选择say SMS,然后在我将另一个图像共享到SMS时不发送而回击,前一个图像将作为附件出现。附加到SMS的图像示例:

这里的关键是,如果您在返回之前从草稿中手动删除图像,或者如果您发送图像,那么您共享的下一个图像将是正确的。我注意到这种行为时,分享短信,闲逛,推特,但不是Facebook。同样重要的是,对于短信、闲逛和推特,手动删除可以解决所有这些问题,Facebook也可以这样做

概述:

在应用程序中,点击共享 从选择器中选择SMS 图像已附加到邮件草稿 回击 消息将被丢弃->确定 在其他项目上,点击共享 从选择器中选择SMS 邮件草稿中附加了与之前相同的图像 我真的不知道接下来该怎么办。这是我这边的问题吗?这是否与在不同应用程序中处理草稿消息有关?如果是,我能做些什么

下面是附加到每个列表元素的共享按钮的共享代码:

if (holder.shareBTN != null) {
    holder.shareBTN.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Bitmap icon = getBitmapFromView(holder.matchWrapperLL, holder.matchWrapperLL.getWidth(), holder.matchMainLL.getHeight());
            Intent share = new Intent(Intent.ACTION_SEND);
            share.setType("image/jpeg");
            ByteArrayOutputStream bytes = new ByteArrayOutputStream();
            icon.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
            String path1 = Environment.getExternalStorageDirectory() + File.separator + "lolhistory_sc.jpg";
            File f = new File(path1);
            try {
                if (f.exists()) {
                    // delete if exists
                    f.delete();
                }
                f.createNewFile();
                FileOutputStream fos = new FileOutputStream(f);
                fos.write(bytes.toByteArray());
                fos.flush();
                fos.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            String path2 = "file://" + f.getAbsolutePath();
            Log.d("", path1);
            Log.d("", path2);
            share.putExtra(Intent.EXTRA_STREAM, Uri.parse(path2));
            startActivity(Intent.createChooser(share, "Share Image"));
        }
    });
}
下面是引用的getBitmapFromView方法:


谢谢你的帮助和建议

将以下标志添加到意图中

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);

嗨,亚历克斯,我也有同样的问题,你解决了吗?不幸的是,我从来没有解决过。这是一个足够的边缘案件,我可以离开它的是。我有一种感觉,这要么是接收应用程序的错误,要么是接收图像发送意图时的默认缓存行为