在我的活动中,我正在实施以下给定的课程
com.Google.androID.gms.common.GooglePlayServicesClIEnt.ConnectionCallbacks,com.Google.androID.gms.common.GooglePlayServicesClIEnt.OnConnectionFailedListener,com.Google.androID.gms.common.API.Googleapiclient.ConnectionCallbacks,com.Google.androID.gms.common.API.Googleapiclient.OnConnectionFailedListener
这两个界面用于通过Google plus验证用户.
com.Google.androID.gms.common.API.Googleapiclient.ConnectionCallbacks,com.Google.androID.gms.common.API.Googleapiclient.OnConnectionFailedListener
com.Google.androID.gms.common.GooglePlayServicesClIEnt.ConnectionCallbacks,com.Google.androID.gms.common.GooglePlayServicesClIEnt.OnConnectionFailedListener
这些类中的方法是相同的.
@OverrIDepublic voID onConnected(Bundle connectionHint) {}
和
@OverrIDepublic voID onConnectionFailed(ConnectionResult connectionResult) {}
由于这些方法具有相同的参数和相同的返回类型,因此在同一类中不能有两个.所以我认为我需要确定从Bundle或ConnectionResult调用了哪个接口.我怎么能这样做?我的意思是我需要检查哪个关键值?如果需要任何澄清请评论.
谢谢
解决方法:
将接口实现为匿名成员声明怎么样?
public class Ac { private GooglePlayServicesClIEnt.OnConnectionFailedListener psConnectionFailedListener = new GooglePlayServicesClIEnt.OnConnectionFailedListener() { @OverrIDe public voID onConnectionFailed(ConnectionResult connectionResult) { // implementation } }; private GooglePlayServicesClIEnt.ConnectionCallbacks psConnectionCallbacks = new GooglePlayServicesClIEnt.ConnectionCallbacks() { @OverrIDe public voID onConnected(Bundle bundle) { // implementation } @OverrIDe public voID ondisconnected() { // implementation } }; private Googleapiclient.ConnectionCallbacks GoogleConnectionCallbacks = new Googleapiclient.ConnectionCallbacks() { @OverrIDe public voID onConnected(Bundle bundle) { // implementation } @OverrIDe public voID onConnectionSuspended(int i) { // implementation } }; private Googleapiclient.OnConnectionFailedListener GoogleConnectionFailedListener = new Googleapiclient.OnConnectionFailedListener() { @OverrIDe public voID onConnectionFailed(ConnectionResult connectionResult) { // implementation } };}
总结 以上是内存溢出为你收集整理的java – Gplus用户身份验证和获取用户在同一活动中的位置全部内容,希望文章能够帮你解决java – Gplus用户身份验证和获取用户在同一活动中的位置所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)