public void shareUsingAutomaticDialog() { if (playerChoice == INVALID_CHOICE || computerChoice == INVALID_CHOICE) { ShareContent content = getLinkContent(); // share the app if (shareDialog.canShow(content, ShareDialog.Mode.AUTOMATIC)) { shareDialog.show(content, ShareDialog.Mode.AUTOMATIC); } else { showError(R.string.share_dialog_error); } } else { ShareContent content = getThrowActionContent(); if (shareDialog.canShow(content, ShareDialog.Mode.AUTOMATIC)) { shareDialog.show(content, ShareDialog.Mode.AUTOMATIC); } else { showError(R.string.share_dialog_error); } } }