本文整理汇总了Java中com.facebook.widget.FacebookDialog.MessageDialogBuilder方法的典型用法代码示例。如果您正苦于以下问题:Java FacebookDialog.MessageDialogBuilder方法的具体用法?Java FacebookDialog.MessageDialogBuilder怎么用?Java FacebookDialog.MessageDialogBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.widget.FacebookDialog
的用法示例。
在下文中一共展示了FacebookDialog.MessageDialogBuilder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shareOnFacebookMessenger
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
private void shareOnFacebookMessenger(String link, String picUrl) {
// Check if the Facebook app is installed and we can present the share dialog
FacebookDialog.MessageDialogBuilder messageDialogBuilder = new FacebookDialog.MessageDialogBuilder(this)
.setCaption(getString(R.string.app_name))
.setName(getString(R.string.app_name))
.setLink(link)
.setPicture(picUrl)
.setDescription(mFortune.toString());
// If the Facebook app is installed and we can present the share dialog
if (messageDialogBuilder.canPresent()) {
uiHelper.trackPendingDialogCall(messageDialogBuilder.build().present());
} else {
Toast.makeText(this, getString(R.string.facebook_messenger_not_installed_or_outdated), Toast.LENGTH_SHORT).show();
openGooglePlayIfPossible(getString(R.string.facebook_messenger_main_package));
}
}
示例2: onOptionsItemSelected
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_add) {
startNewMessage();
return true;
} else if (id == R.id.invite) {
FacebookDialog.MessageDialogBuilder builder = buildInviteFriendsDialog();
// If the Messaging Facebook app is installed and we can present the share dialog
if (builder.canPresent()) {
FacebookDialog dialog = builder.build();
dialog.present();
return true;
}
} else if (id == R.id.sent_messages) {
Intent intent = new Intent(this, ConversationActivity.class);
intent.putExtra("sentMessages", true);
startActivity(intent);
} else if (id == R.id.logout) {
ParseUser.logOut();
ParseQuery.clearAllCachedResults();
startActivity(new Intent(this, MainActivity.class));
finish();
}
return super.onOptionsItemSelected(item);
}
示例3: buildInviteFriendsDialog
import com.facebook.widget.FacebookDialog; //导入方法依赖的package包/类
private FacebookDialog.MessageDialogBuilder buildInviteFriendsDialog() {
return new FacebookDialog.MessageDialogBuilder(this)
.setLink("www.catchatapp.com")
.setName(getString(R.string.fb_msg_name))
.setCaption(getString(R.string.fb_msg_caption))
.setDescription(getString(R.string.fb_msg_description))
.setPicture("http://bit.ly/RPsDPY");
}