Skip to content
This repository has been archived by the owner on Aug 3, 2019. It is now read-only.

LikeView

HakAl edited this page Aug 20, 2015 · 6 revisions

To use LikeView all you need to do is:

1. Add this to your layout. Like this:

<com.facebook.share.widget.LikeView
    android:id="@+id/like_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
</com.facebook.share.widget.LikeView>

2. Set in your activity or fragment (just as any other view).

mLikeView = (LikeView) findViewById(R.id.like_view);
mLikeView.setObjectId("1501124800143936");

That's it
No need to add anything to onActivityResult and so on, since this lib already cares for this stuff. Make sure to call FacebookSdk.sdkInitialize() first.

Sample app

You will find the example with this button in the sample app. (Misc section)

This is what I got:

LikeView

Reference

The full doc on facebook side: https://developers.facebook.com/docs/android/like-button

Clone this wiki locally