title: Post Photo to Facebook from Android Application, Photo taken from Android Gallery
body: <p>I am currently developing an Android Application target build is 4.0 Ice-Cream Sandwich.</p>
  
  <p>So far, I am able to post a normal Text onto Facebook with this code:</p>
  
  <pre><code>public void postToWall() {
  
        // post on user's wall.
  
          facebook.dialog(this, "feed", new DialogListener() {
  
      @Override
      public void onFacebookError(FacebookError e) {
      }
  
      @Override
      public void onError(DialogError e) {
      }
  
      @Override
      public void onComplete(Bundle values) {
      }
  
      @Override
      public void onCancel() {
      }
          });
  
  }
  </code></pre>
  
  <p>However, I am unable to post a photo onto Facebook with Captions. I've search around online and one of the codes I found is this:</p>
  
  <pre><code>public void postToWall() {
          // post on user's wall.
          byte[] data = null;
  
          Bitmap bi = BitmapFactory.decodeFile(photoToPost);
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          bi.compress(Bitmap.CompressFormat.JPEG, 100, baos);
          data = baos.toByteArray();
  
          Bundle params = new Bundle();
          params.putString("method", "photos.upload");
          params.putByteArray("picture", data);
  
          AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
          mAsyncRunner.request(null, params, "POST", new SampleUploadListener(), null);
  
      }
  </code></pre>
  
  <p>The problem is, the above code is not working as I don't know whats:</p>
  
  <p>1.<em>photoToPost</em></p>
  
  <p>2.<em>mAsyncRunner</em>.request keeps giving me an error stating that I cannot put "null" as it is an invalid arguement</p>
  
  <p>3.<em>SampleUploadListener</em>, supposedly is from the FacebookSDK is not working as well (I keep getting an error to create a Class)</p>
  
  <p>Is there a simpler code out here ? Or could someone explain to me the errors I am experiencing. </p>
  
  <p>I am using an "On Click" so far to post normal Text onto Facebook and it points to this method. My goal is to upload a Photo with a Caption onto Facebook. </p>
  
  <p>Thank you all for helping !</p>