关于ShareCompat的意义

Extra helper functionality for sharing data between activities. ShareCompat provides functionality to extend theACTION_SENDACTION_SEND_MULTIPLE protocol and support retrieving more info about the activity that invoked a social sha ring action. ShareCompat.IntentBuilder provides helper functions for constructing a sharing intent that always includes data about the calling activity and app. This lets the called activity provide attribution for the app that shared content. Constructing an intent this way can be done in a method-chaining style. To obtain an IntentBuilder with info about your calling activity, use the static method from(Activity)ShareCompat.IntentReaderprovides helper functions for parsing the defined extras within an ACTION_SEND or ACTION_SEND_MULTIPLE intent used to launch an activity. You can also obtain a Drawable for the caller's application icon and the application's localized label (the app's human-readable name). Social apps that enable sharing content are encouraged to use this information to call out the app that the content was shared from.

     这个是在activities共享数据的辅助功能类。ShareCompat提供了扩展ACTION_SEND/ACTION_SEND_MULITPLE端口和支持获取更多的数据关于activity来触发一个social sha ring。ShareCompat.IntentBuilder提供了帮助功能来构造一个共享的intent,它包含了关于调用activity和app的所有数据。这让调用的activity提供了共享内容的app的属性。

      ShareCompat.IntentBuilder b=ShareCompat.IentBuilder.from(this);

      b.setType("text/plain").setText("Share from Menu");

      MenuItem item=menu.add("share");

      ShareCompt.configureMenuItem(item,b);

      MenuItemCompt.setShowAsAction(item,MenuITemCompt.Show_AS_ACTION_IF_ROOM);


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值