1
我有一個用Titanium編寫的應用程序。 在Android設備上的照片庫中,單擊通過共享。圖片可以通過Gmail,消息,Goolge +,...分享... 我想添加一個圖片可以通過我的應用程序共享的選項。 這個過程是否有解決方案?如何將照片庫中的照片分享給我的應用程序?
謝謝。
我有一個用Titanium編寫的應用程序。 在Android設備上的照片庫中,單擊通過共享。圖片可以通過Gmail,消息,Goolge +,...分享... 我想添加一個圖片可以通過我的應用程序共享的選項。 這個過程是否有解決方案?如何將照片庫中的照片分享給我的應用程序?
謝謝。
你需要添加一個意圖過濾器攔截正確Intant.ACTION_SEND
如圖所示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();
現在,它的圖標時,按「通過分享」在照片庫中。但是當打開應用程序時,我無法抓住意圖獲取圖像。 – batanlp 2013-05-06 10:25:21