【问题标题】:Connecting to Google Play game services for all activities within a project为项目中的所有活动连接到 Google Play 游戏服务
【发布时间】:2016-07-29 23:27:13
【问题描述】:

基于来自 (https://github.com/playgameservices/android-basic-samples) 的 Google Play 游戏服务示例,尤其是 TypeANumber,我想知道是否更愿意将所有活动实现为 片段(除了负责如果我希望我的应用始终连接到服务,则实例化并连接到 GoogleApiClient。

因为,我已经开发了一个游戏应用,其中包含使用 Bundles 和 Intents 相互转换的 Activity,现在我才刚刚开始弄清楚如何在我的游戏中实现 Google Play 游戏服务。我已经阅读了教程等等,但我只想知道是否建议将片段用于其他活动。

【问题讨论】:

    标签: android android-fragments android-studio google-play-services android-fragmentactivity


    【解决方案1】:

    换句话说,您几乎只是在问ActivityFragment 之间哪个更好用。从技术上讲,它仍然取决于您的目标。逛了一圈社区,发现这些帖子的答案非常详细:

    Dilemma: when to use Fragments vs Activities:

    Why fragments, and when to use fragments instead of activities?

    简单来说,当需要可重用性时,我更喜欢使用Fragment

    【讨论】:

      猜你喜欢
      • 2013-05-19
      • 2017-06-13
      • 1970-01-01
      • 1970-01-01
      • 2017-03-11
      • 2014-02-02
      • 1970-01-01
      • 2014-10-19
      相关资源
      最近更新 更多