您需要添加一个意图过滤器来拦截正确的,Intant.ACTION_SEND
如下所示:
<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();