Click here to Skip to main content
14,937,132 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the following code for my Share Dialog inside the fragment:

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;

public void onCreate(Bundle savedInstanceState) {
    uiHelper = new UiLifecycleHelper(getActivity(), callback);

    OpenGraphAction action = GraphObject.Factory.create(OpenGraphAction.class);
    action.setProperty("book", "");

    FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(getActivity(), action, "books.reads", "book")

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    uiHelper.onActivityResult(requestCode, resultCode, data, new FacebookDialog.Callback() {
        public void onError(FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) {
            Log.e("Activity", String.format("Error: %s", error.toString()));

        public void onComplete(FacebookDialog.PendingCall pendingCall, Bundle data) {
            Log.i("Activity", "Success!");

public void onResume() {

public void onSaveInstanceState(Bundle outState) {

public void onPause() {

public void onDestroy() {
private Session.StatusCallback callback = new Session.StatusCallback() {

    public void call(Session session, SessionState state,
            Exception exception) {
        // TODO Auto-generated method stub


The Facebok Share loads on the emulator, however it does not on a phone. Also when the Share Dialog loads on the emulator, you can't share it because the share button on the upper left is disabled(visible but can't be clicked). Also, the emulator displays a toast message "Share Preview could not be fetched." Please help!

I hope someone can explain this to me. Thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900