Android按钮当机 [英] Android button crashes

查看:131
本文介绍了Android按钮当机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个动作栏共享按钮,但是当我运行该应用程序时,该按钮确实起作用,但是当我尝试与其他应用程序共享图像时,该应用程序崩溃了.例如,如果我与Twitter共享图像或消息,则应用程序崩溃,并说"Twitter或Message崩溃.

I have developed a actionbar share button, however when I run the app the button does work but it crashes the application when I try to share the images with other apps. For example if I share the image with Twitter or message the application just crashes and says that "Twitter or Message has crashed.

推荐答案

EXTRA_STREAM 实际上,您通常可以使用file: Uri指向

In practice, you can often use a file: Uri pointing to a file on external storage, though that will be a problem more and more as time goes along.

您正在尝试使用android.resource:.通常,很少有应用程序支持android.resource: Uri值,更不用说EXTRA_STREAM了.

You are trying to use android.resource:. Few apps support android.resource: Uri values in general, let alone for EXTRA_STREAM.

您的选择是:

  1. 将资源写到文件中,然后使用FileProviderfile: Uri

使用我的StreamProvider 通过content:

请勿尝试共享资源

除此之外,还请注意,您的android.resource Uri似乎很乱,因为您似乎有一个换行符和文字字符串"getPackageName()"作为值的一部分.

Beyond that, also note that your android.resource Uri seems rather mangled, as you seem to have a newline character and the literal string "getPackageName()" as part of the value.

这篇关于Android按钮当机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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