Home Android Tutorial How to Add Facebook Comments in Android App

How to Add Facebook Comments in Android App

How to Add Facebook Comments in Android App
Add Facebook Comments in Android App

Facebook comments plugin lets users to comment on any web url using their Facebook account. Right now Facebook doesn’t provide native android support for the plugin, but we can integrate it in our app using the WebView and make it looks native. This article not only explains how to add the fb comments widget, but also covers how to load a full article, particularly when you are designing a newsfeed app.

Getting Started
In this tutorial, you will learn how to add facebook comment widget into your android application.

1.1 Creating a new project
Follow steps written below to create a new project.
a. Goto File –> New –> New Project. Then, Write application name as FacebookCommentsTutorial and click next.
b. Select Minimum SDK 15 or more –> click next –> Select Empty Activity –> click next –> click finish.
If you have followed above process correctly, you will get a newly created project successfully.

1.2. Basic setup for Android Facebook SDK
You need to do some setup to use facebook sdk into your application. I have already discussed about it into this tutorial. Please have a look at this post and integrate facebook sdk into your project. However, let me give brief explanation about what i have done till now to setup facebook sdk.

By adding facebook comment widget, you let the user allow to comment on your post in website. Here, we are going to use facebook widget(created using html and javascript). We are also adding WebViewClient (that will receive various notifications and requests) and WebChromeClient(A handler for Chrome to handle JavaScript dialogs, favicons, titles, and the progress.).