title: invalid application id
body: <p>I am using following code to load an image from android app to facebook. I have installed facebook sdk for android. But the app is not doing the intended. I am getting "invalid application id" in the logcat. What mistake am I making ?</p>
  
  <pre><code>Button mButton=(Button)findViewById(R.id.button);
  
  mButton.setOnClickListener(new View.OnClickListener() {
           public void onClick(View v) {
               Facebook mFacebook=new Facebook(yourAppID)
  
      byte[] data = null;
      Bitmap bi = BitmapFactory.decodeFile(imageLink);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      bi.compress(Bitmap.CompressFormat.PNG, 100, baos);
      data = baos.toByteArray();
  
      Bundle params = new Bundle();
      params.putString("method", "photos.upload");
      params.putByteArray("picture", data);
  
      AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(mFacebook);
      mAsyncRunner.request(null, params, "POST",
              new SampleUploadListener(), null);
           }
       });
  
  
  
  
  
  
  
  public class SampleUploadListener extends BaseRequestListener {
  
      @SuppressWarnings("unused")
      public void onComplete(final String response, final Object state) {
          try {
              Log.d("Facebook-Example", "Response: " + response.toString());
              JSONObject json = Util.parseJson(response);
              String src = json.getString("src");
  
              PublishImage.this.runOnUiThread(new Runnable() {
                  public void run() {
                      Toast.makeText(getApplicationContext(),
                              "Successfully Uploaded", Toast.LENGTH_SHORT)
                              .show();
                  }
              });
          } catch (JSONException e) {
              Log.w("Facebook-Example", "JSON Error in response");
          } catch (FacebookError e) {
              Log.w("Facebook-Example", "Facebook Error: " + e.getMessage());
          }
      }
  }
  
  public abstract class BaseRequestListener implements RequestListener {
  
      public void onFacebookError(FacebookError e, final Object state) {
          Log.e("Facebook", e.getMessage());
          e.printStackTrace();
      }
  
      public void onFileNotFoundException(FileNotFoundException e,
              final Object state) {
          Log.e("Facebook", e.getMessage());
          e.printStackTrace();
      }
  
      public void onIOException(IOException e, final Object state) {
          Log.e("Facebook", e.getMessage());
          e.printStackTrace();
      }
  
      public void onMalformedURLException(MalformedURLException e,
              final Object state) {
          Log.e("Facebook", e.getMessage());
          e.printStackTrace();
      }
  
  }
  </code></pre>
  
  <p>Logcat</p>
  
  <pre><code>06-15 20:00:55.398: W/KeyCharacterMap(629): No keyboard for id 0
  06-15 20:00:55.398: W/KeyCharacterMap(629): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
  06-15 20:01:02.438: D/dalvikvm(629): GC_EXTERNAL_ALLOC freed 1214K, 59% free 2755K/6599K, external 1995K/2266K, paused 630ms
  06-15 20:01:08.998: D/MediaPlayer(629): getMetadata
  06-15 20:01:15.529: D/Facebook-Example(629): Response: {"error_code":101,"error_msg":"Invalid application ID.","request_args":[{"key":"method","value":"photos.upload"},{"key":"format","value":"json"}]}
  06-15 20:01:15.529: W/Facebook-Example(629): Facebook Error: Invalid application ID.
  </code></pre>
  
  <p><strong>EDIT: This worked</strong></p>
  
  <pre><code>class ButtonListener1 implements View.OnClickListener{
  
      Facebook facebook=new Facebook(ID);
  
      @Override
      public void onClick(View v) {
  
          facebook.authorize(Pic.this, new String[] { "publish_stream" },
                  new DialogListener() {
  
              @Override
              public void onFacebookError(FacebookError e) {
              // TODO Auto-generated method stub
              }
  
              @Override
              public void onError(DialogError dialogError) {
              // TODO Auto-generated method stub
              }
  
              @Override
              public void onComplete(Bundle values) {
                  postToWall(values.getString(Facebook.TOKEN));                                              
              }
  
              private  void postToWall(String accessToken) {    
  
  
                  ByteArrayOutputStream baos = new ByteArrayOutputStream();
                  bmp.compress(Bitmap.CompressFormat.PNG, 100, baos);
                  byte[] data = baos.toByteArray();
                  Bundle bundle = new Bundle();
  
                  bundle.putString(Facebook.TOKEN, accessToken);
                  bundle.putByteArray("facebookPictureData", data);
                  // The byte array is the data of a picture.
                  bundle.putByteArray("picture", getIntent().getExtras().getByteArray("data"));
  
                  try {
                      facebook.request("me/photos", bundle, "POST");
  
                  } catch (FileNotFoundException fileNotFoundException) {
                     // makeToast(fileNotFoundException.getMessage());
                  } catch (MalformedURLException malformedURLException) {
                     // makeToast(malformedURLException.getMessage());
                  } catch (IOException ioException) {
                     // makeToast(ioException.getMessage());
                  }
              }
  
  
              @Override
              public void onCancel() {
              // TODO Auto-generated method stub
              }
          });
  
  
  
       }
  }
  </code></pre>