title: Android/Facebook: Post message on wall
body: <p>I would like to post a message on the my own wall via an Android application. I have the method loginToFacebook() to login. On click on a button, if the user is logged in I want a message to be posted. I am not really familiar with facebook API so I've looked the facebook developers documentation and other sites on internet to propose the code that follows. Yet, no message is posted on my wall. Obviously I miss something but I don't know what as I have no error on my LogCat.</p>
  
  <pre><code>public class ShareActivity extends Activity implements OnClickListener{
      Facebook facebook = new Facebook("477110419013909");
      AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
      String FILENAME = "AndroidSSO_data";
      SharedPreferences mPrefs;
  
  
    public void onClick(View arg0) {
          loginToFacebook();
          if (facebook.isSessionValid()) {
              Bundle bundle = new Bundle();
              bundle.putString("message","Hey Facebook!");
              try {
                  String strRet = facebook.request("/me/feed",bundle,"POST");
              } catch (FileNotFoundException e) {
                  // TODO Auto-generated catch block
                  Log.e("Facebook", "Error: " + e.getMessage());
              } catch (MalformedURLException e) {
                  // TODO Auto-generated catch block
                  Log.e("Facebook", "Error: " + e.getMessage());
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  Log.e("Facebook", "Error: " + e.getMessage());
              }
  
  }
  
  public void loginToFacebook() {
      mPrefs = getPreferences(MODE_PRIVATE);
      String access_token = mPrefs.getString("access_token", null);
      long expires = mPrefs.getLong("access_expires", 0);
  
      if (access_token != null) {
          facebook.setAccessToken(access_token);
      }
  
      if (expires != 0) {
          facebook.setAccessExpires(expires);
      }
  
      if (!facebook.isSessionValid()) {
          facebook.authorize(this,
                  new String[] { "email", "publish_stream" },
                  new DialogListener() {
  
                      @Override
                      public void onCancel() {
                          // Function to handle cancel event
                      }
  
                      @Override
                      public void onComplete(Bundle values) {
                          // Function to handle complete event
                          // Edit Preferences and update facebook acess_token
                          SharedPreferences.Editor editor = mPrefs.edit();
                          editor.putString("access_token",
                                  facebook.getAccessToken());
                          editor.putLong("access_expires",
                                  facebook.getAccessExpires());
                          editor.commit();
                      }
  
                      @Override
                      public void onError(DialogError error) {
                          // Function to handle error
  
                      }
  
                      @Override
                      public void onFacebookError(FacebookError fberror) {
                          // Function to handle Facebook errors
  
                      }
  
                  });
      }
  }
  }
  </code></pre>
  
  <p>I tried to do</p>
  
  <pre><code>if (facebook.isSessionValid()) {
              Bundle bundle = new Bundle();
              bundle.putString("message","Hey Facebook!");
  
              facebook.dialog((Activity) this, "feed", bundle,
                      new DialogListener() {
  
                          public void onComplete(Bundle values) {
                          }
  
                          public void onFacebookError(FacebookError error) {}
                          public void onError(DialogError e) {}
                          public void onCancel() {}
              });
   }
  </code></pre>
  
  <p>Did not work either</p>