I have the following code for my sharing dialog inside the fragment:
TabFour.java
public class TabFour extends Fragment { private UiLifecycleHelper uiHelper; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.activity_tab_four, container, false); return rootView; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiHelper = new UiLifecycleHelper(getActivity(), callback); uiHelper.onCreate(savedInstanceState); OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class); action.setProperty("book", "https://example.com/book/Snow-Crash.html"); @SuppressWarnings("deprecation") FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(getActivity(), action, "books.reads", "book") .build(); uiHelper.trackPendingDialogCall(shareDialog.present()); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); uiHelper.onActivityResult(requestCode, resultCode, data, new FacebookDialog.Callback() { @Override public void onError(FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) { Log.e("Activity", String.format("Error: %s", error.toString())); } @Override public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) { Log.i("Activity", "Success!"); } }); } @Override public void onResume() { super.onResume(); uiHelper.onResume(); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); uiHelper.onSaveInstanceState(outState); } @Override public void onPause() { super.onPause(); uiHelper.onPause(); } @Override public void onDestroy() { super.onDestroy(); uiHelper.onDestroy(); } private Session.StatusCallback callback = new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) {
}
Facebok Share downloads the emulator, however it does not work on the phone. Also, when the emulator is loaded on the "Sharing" tab, you cannot use it because the sharing button in the upper left corner is disabled (visible, but cannot be pressed). In addition, the emulator displays a toast message "Preview cannot be selected." Please, help!
Hope someone can explain this to me. Thanks!
source share