title: hi..Android facebook app sharing not working
body: <p>I am new to android facebook app sharing,I want to make app sharing demo using android ,And have made a demo using <a href="https://developers.facebook.com/docs/android/share#interfaces" rel="nofollow">Faceboook app sharing</a></p>
  
  <p>I have tried step by step,My code is as below,But It gives me error that ApplicatioID Parametere must not null,I am having my appId,But I dont know where to pass it as parameter.My code is:</p>
  
  <pre><code>package com.example.appsahre;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.Toast;
  
  import com.facebook.FacebookException;
  import com.facebook.FacebookOperationCanceledException;
  import com.facebook.Session;
  import com.facebook.UiLifecycleHelper;
  import com.facebook.widget.FacebookDialog;
  import com.facebook.widget.WebDialog;
  import com.facebook.widget.WebDialog.OnCompleteListener;
  
  public class MainActivity extends Activity {
      private UiLifecycleHelper uiHelper;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          uiHelper = new UiLifecycleHelper(this, null);
          uiHelper.onCreate(savedInstanceState);
          FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
                  .setLink("https://developers.facebook.com/android").build();
          uiHelper.trackPendingDialogCall(shareDialog.present());
          publishFeedDialog();
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          // TODO Auto-generated method stub
          super.onActivityResult(requestCode, resultCode, data);
          uiHelper.onActivityResult(requestCode, resultCode, data,
                  new FacebookDialog.Callback() {
  
                      @Override
                      public void onComplete(
                              FacebookDialog.PendingCall pendingCall, Bundle data) {
                          Log.i("Activity", "Success!");
                      }
  
                      @Override
                      public void onError(FacebookDialog.PendingCall pendingCall,
                              Exception error, Bundle data) {
                          Log.e("Activity",
                                  String.format("Error: %s", error.toString()));
                      }
  
                  });
  
      }
  
      @Override
      protected void onResume() {
          // TODO Auto-generated method stub
          super.onResume();
          uiHelper.onResume();
      }
  
      @Override
      protected 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 void publishFeedDialog() {
          Bundle params = new Bundle();
          params.putString("name", "Facebook SDK for Android");
          params.putString("caption",
                  "Build great social apps and get more installs.");
          params.putString(
                  "description",
                  "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
          params.putString("link", "https://developers.facebook.com/android");
          params.putString("picture",
                  "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");
  
          WebDialog feedDialog = (new WebDialog.FeedDialogBuilder(
                  MainActivity.this, Session.getActiveSession(), params))
                  .setOnCompleteListener(new OnCompleteListener() {
  
                      @Override
                      public void onComplete(Bundle values,
                              FacebookException error) {
                          if (error == null) {
                              // When the story is posted, echo the success
                              // and the post Id.
                              final String postId = values
                                      .getString("1429518160643697");
                              if (postId != null) {
                                  Toast.makeText(MainActivity.this,
                                          "Posted story, id: " + postId,
                                          Toast.LENGTH_SHORT).show();
                              } else {
                                  // User clicked the Cancel button
                                  Toast.makeText(MainActivity.this,
                                          "Publish cancelled", Toast.LENGTH_SHORT)
                                          .show();
                              }
                          } else if (error instanceof FacebookOperationCanceledException) {
                              // User clicked the "x" button
                              Toast.makeText(MainActivity.this,
                                      "Publish cancelled", Toast.LENGTH_SHORT)
                                      .show();
                          } else {
                              // Generic, ex: network error
                              Toast.makeText(MainActivity.this,
                                      "Error posting story", Toast.LENGTH_SHORT)
                                      .show();
                          }
                      }
  
                  }).build();
          feedDialog.show();
      }
  }
  </code></pre>