如何将照片库中的图片分享到我的应用程序?

时间:2013-05-06 06:52:46

标签: android titanium image

我有一个用Titanium编写的应用程序。  在Android设备上,在照片库中,单击“共享”。图片可以通过Gmail,Message,Goolge +分享,...  我想添加一个图片可以通过我的应用程序共享的选项。  这个过程有没有解决方案?

感谢。

1 个答案:

答案 0 :(得分:0)

您需要添加一个意图过滤器来截取正确的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();
相关问题