android - Google Plus Logout button not working -
android - Google Plus Logout button not working -
i have followed quick start sample app google developer site https://developers.google.com/+/quickstart/android , worked pretty sign in button, signout , revoke buttons on same activity.
but when tried move signout button new activity , calls signout button started crashing.
this i'm trying :
@override public void onconnected(bundle connectionhint) { // reaching onconnected means consider user signed in. log.i(tag, "onconnected"); // update user interface reflect user signed in. // retrieve profile info personalize our app user. person currentuser = plus.peopleapi.getcurrentperson(mgoogleapiclient); mstatus.settext(string.format( getresources().getstring(r.string.signed_in_as), currentuser.getdisplayname())); intent myintent = new intent(loginactivity.this, logoutactivityty.class); //myintent.putextra("gusername", currentuser.getdisplayname()); startactivity(myintent); // indicate sign in process complete. msigninprogress = state_default; }
this logout activity:
logout = (button) findviewbyid(r.id.sign_out_button); logout.setonclicklistener(new onclicklistener() { @override public void onclick(view arg0) { if (mgoogleapiclient.isconnected()) { plus.accountapi.cleardefaultaccount(mgoogleapiclient); mgoogleapiclient.disconnect(); mgoogleapiclient.connect(); intent = new intent(logoutactivity.this, loginactivity.class); startactivity(i); toast.maketext(getapplicationcontext(), "logged out using google account", toast.length_long).show(); } } });
android android-activity google-plus
Comments
Post a Comment