Google +1 button failed to load on clicking undo button android

145 Views Asked by At

I am implementing google plus one button and it's working fine when I click on +1 button and then click OK on pop up. But when I click the UNDO button the +1 button grayed out.If i clear the app data from setting than it starts working properly otherwise +1 button remains grayed. Is this some bug or there is some solution to this problem? Below is the code I am using.
In onCreate:

mPlusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button);
        mPlusOneButton.setOnPlusOneClickListener(new PlusOneButton.OnPlusOneClickListener() {
            @Override
            public void onPlusOneClick(Intent intent) {
                    try {
                        startActivityForResult(intent, 0);
                    }catch (NullPointerException e){


                    }

            }
        });

In onResume:

mPlusOneButton.initialize(URL, PLUS_ONE_REQUEST_CODE);

And:

 @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == -1) {
            // OK or SHARE
            System.out.println("OK or SHARE");
            mPlusOneButton.setIntent(null);
        } else {
            //UNDO
        System.out.println("UNDO");
        }
    }
0

There are 0 best solutions below