如何从相册分享图片为我的应用程序? [英] How to share picture from Photo Gallery to my application?
本文介绍了如何从相册分享图片为我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经写在钛的应用程序。
和Android设备上,在照片库中,通过点击份额。图片可以通过Gmail分享,留言,Goolge的+,...
我想补充一点,画面可以通过我的应用程序共享一个更多的选择。
有没有对这个过程的任何解决方案?
I have an application written in Titanium. And on Android device, in Photo gallery, click share via. Picture can share via Gmail, Message, Goolge+, ... I want add one more option that picture can share via my application. Is there have any solution for this process?
感谢。
推荐答案
您需要添加一个意图过滤拦截正确的 Intant.ACTION_SEND
如图所示的这里:
you need to add an intent filter to intercept the correct Intant.ACTION_SEND
as shown here:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
var win = Ti.UI.createWindow({
backgroundColor: '#fff',
fullscreen: false,
exitOnClose: true
});
win.addEventListener('open', function(e) {
var intent = Ti.Android.currentActivity.getIntent();
var iname = Ti.Android.EXTRA_STREAM;
if (intent && intent.hasExtra(iname)) {
// Create ImageView from TiBlob
var blob = intent.getBlobExtra(iname);
win.add(Ti.UI.createImageView({
image: blob,
height: 300,
width: 300,
left: 0,
top: 0
}));
} else {
Ti.API.info('No extra named "' + iname + '" found in Intent');
}
});
win.open();
这篇关于如何从相册分享图片为我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文