content: package yifeiyuan.practice.practicedemos.thirdparty;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.design.widget.FloatingActionButton;
  import android.support.design.widget.Snackbar;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.util.Log;
  
  import yifeiyuan.practice.practicedemos.R;
  
  public class FacebookActivity extends AppCompatActivity {
  
      public static final String TAG = "FacebookActivity";
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_facebook);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
          fab.setOnClickListener(view -> Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                  .setAction("Action", v -> {
                      shareToFb();
                  }).show());
      }
  
      private void shareToFb() {
  
          String title = "share to fb test";
          Intent sendIntent = new Intent();
          sendIntent.setAction(Intent.ACTION_SEND);
          sendIntent.putExtra(Intent.EXTRA_TEXT,title);
          sendIntent.setType("text/plain");
          startActivityForResult(sendIntent, 1);
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          if (resultCode == Activity.RESULT_OK) {
              Log.d(TAG, "onActivityResult: OKOKOKOKOKO");
          }else if (Activity.RESULT_CANCELED == resultCode) {
              Log.d(TAG, "onActivityResult: Canceled");
          }
          Log.d(TAG, "onActivityResult() called with: " + "requestCode = [" + requestCode + "], resultCode = [" + resultCode + "], data = [" + data + "]");
      }
  }
  