I'm developing a material design app.
I want to open my app's facebook page when user clicks on the 'like on facebook' text (layout) in my app.
I've managed to open the facebook app but I am unable to figure out how can I open my page directly!
Here's what I've done so far:
LinearLayout linearLayoutFacebookContainer = (LinearLayout) findViewById(R.id.facebook_container);
linearLayoutFacebookContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final Handler handler3 = new Handler();
handler3.postDelayed(new Runnable() {
@Override
public void run() {
Intent facebookIntent = getPackageManager().getLaunchIntentForPackage("com.facebook.katana");
if (facebookIntent != null) {
// We found the activity now start the activity
facebookIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
facebookIntent.setData(Uri.parse("https://www.facebook.com/HumaneHelper/"));
startActivity(facebookIntent);
} else {
// Bring user to the market or let them choose an app?
facebookIntent = new Intent(Intent.ACTION_VIEW);
facebookIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
facebookIntent.setData(Uri.parse("https://www.facebook.com/HumaneHelper/"));
startActivity(facebookIntent);
}
}
}, 200);
}
});
Please let me know.
I'm a beginner, please cooperate.
Thanks in advance.