I have an android example using Google+ signin
service. When start app, Google+ signin
button appear with Login
string.
How to set text Logout
for Google+ signin
button after connected and authenticated.
Help me this issue.
After successful connection has been established by the GooglePlus client, the onConnected()
callback is invoked.
So, all you need to do is change the text of the Button as soon as the user has been logged in.
@Override
public void onConnected() {
//called after successful connection
setGooglePlusButtonText(signInButton, R.string.googleplus_signout);
}
protected void setGooglePlusButtonText(SignInButton signInButton, String buttonText) {
for (int i = 0; i < signInButton.getChildCount(); i++) {
View v = signInButton.getChildAt(i);
if (v instanceof TextView) {
TextView mTextView = (TextView) v;
mTextView.setText(buttonText);
return;
}
}
}
Use native Button for sign in/sign out with backgound - @drawable/common_signin_btn_text_dark
<Button
android:id="@+id/gplus_sign_in_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/connect_with_gplus"
android:background="@drawable/common_signin_btn_text_dark"
android:textColor="@color/white"
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With