Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>With the Google+ platform for Android, you are now able to integrate a native +1 button in your Android app.</p> <p>1) You first need to <a href="https://developers.google.com/+/mobile/android/#initialize_the_plusclient" rel="noreferrer">initialize</a> the <code>PlusClient</code> object in your Activity.</p> <p>2) Include the PlusOneButton in your layout:</p> <pre><code> &lt;com.google.android.gms.plus.PlusOneButton xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" android:id="@+id/plus_one_button" android:layout_width="wrap_content" android:layout_height="wrap_content" plus:size="standard" plus:annotation="inline" /&gt; </code></pre> <p>3) Assign the PlusOneButton to a member variable in your Activity.onCreate handler.</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPlusClient = new PlusClient(this, this, this); mPlusOneButton = (PlusOneButton) findViewById(R.id.plus_one_button); } </code></pre> <p>4) Refresh the PlusOneButton's state each time the activity receives focus in your Activity.onResume handler.</p> <pre><code>protected void onResume() { super.onResume(); // Refresh the state of the +1 button each time the activity receives focus. mPlusOneButton.initialize(mPlusClient, URL); } </code></pre> <p>For more information, see <a href="https://developers.google.com/+/mobile/android/#recommend_content_with_the_1_button" rel="noreferrer">https://developers.google.com/+/mobile/android/#recommend_content_with_the_1_button</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload