Android studio无法解析方法getActivity()

时间:2018-06-17 19:10:50

标签: android android-studio android-activity android-fragmentactivity

我收到此错误,但我不知道如何修复它。我试着看这里,但没有用。有人可以帮帮我吗?

Error

1 个答案:

答案 0 :(得分:0)

PendingIntent.getActivity的完整语法是

public static PendingIntent getActivity (Context context, 
                int requestCode, 
                Intent intent, 
                int flags)

您没有传递任何参数。

修改:

我认为你在这里不需要getActivity。 仅将GoogleApiClient(_gameHelper.getApiClient())传递给getAllLeaderboardsIntentgetAchievementsIntent

修改:

不推荐使用成就和排行榜。

https://developers.google.com/android/reference/com/google/android/gms/games/achievement/Achievements

https://developers.google.com/android/reference/com/google/android/gms/games/leaderboard/Leaderboards