如何在Facebook,Twitter,邮件...中共享位图,而又不将图像保存在内部或外部存储中?
First, I would temporarily write your bitmap to external storage , and use that to debug your basic share-the-file logic.
Then, implement a ContentProvider
, where you override openFile()
and serve up your byte[]
of PNG (or JPEG or whatever). Then use a content://
Uri
pointing at your ContentProvider
in your ACTION_SEND
Intent
, instead of a Uri
pointing at external storage.
This sample project demonstrates the basic structure. In my case, I am serving a file from assets, rather than from memory, so you would change that portion of the logic. Also, I am using the ContentProvider
for an ACTION_VIEW
request instead of ACTION_SEND
, so there would need to be changes there.
How well this will work will depend on how quickly the third-party app will read in the contents from your provider and whether you can arrange to hold onto the bitmap in memory that long.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.