In my Android app I am giving the possibility to tap on a Google +1 button.
This works fine with the following code from the developpers source material (https://developers.google.com/+/mobile/android/recommend):
mPlusClient = new PlusClient.Builder(this, this, this)
.clearScopes()
.build();
mPlusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button);
Now I would like to detect when the user taps on this button, so I tried this:
mPlusOneButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Toast.makeText(this, "Thanks for your +1", Toast.LENGTH_LONG).show();
}
});
But it doesn't do anything, it doesn't display the toast message.
As an alternative, I was thinking of having the player tap twice on the button : first being a regular Button object that would make the plus one button visible, second being the plusone button. but it is an awckward user experience
How can I detect user's tap on this button?
Plus one button provides a listener function to detect button click. Here is the code.
mPlusOneButton.setOnPlusOneClickListener(new PlusOneButton.OnPlusOneClickListener() {
@Override
public void onPlusOneClick(Intent intent) {
Log.w(tag,"plus one click");
}
});