本文整理匯總了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");
}