[英]Android: Sharing Bitmap with Intents on other apps
我有一個使用Android查詢創建的位圖文件:
aq = new AQuery(HomeCategoryActivity.this);
aq.ajax(currentUrl,Bitmap.class,0,new AjaxCallback<Bitmap>(){
@Override
public void callback(String url, Bitmap object, AjaxStatus status) {
if(object != null)
{
bmp = object;
}
}
});
bmp是一個全局初始化的變量,我通過上面的代碼和NOT NULL正確地保存了它。
現在,我想使用此在其他應用程序上共享此位圖:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/jpeg");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(bmp));
startActivity(Intent.createChooser(intent, "Share Product via:"));
因為代碼可能是錯誤的,所以這行不通。 我應該做些什么改變?
我想在Fb,insta等上分享圖片
將位圖保存到外部存儲並獲取位圖圖像的路徑
然后將Uri.parse(path)
傳遞給意圖。
有關更多信息,請參考此鏈接http://developer.android.com/training/sharing/send.html
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/jpeg");
intent.putExtra(Intent.EXTRA_STREAM, Uri.parseUri(path));
startActivity(Intent.createChooser(intent, "Share Product via:"));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.