How to share contents of ListView row on facebook in Android?

I am a newbie to Facebook SDK. I have integrated Facebook in my app.I am trying to share the contents of a ListView row on Facebook. I have done the following code but I don’t seem to understand what to do next. Please guide me step by step.My code is as follows:

  byte[] data = null;
  Drawable myDrawable = getResources().getDrawable(R.drawable.ic_launcher);
  Bitmap myLogo = ((BitmapDrawable) myDrawable).getBitmap();
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  myLogo.compress(Bitmap.CompressFormat.JPEG, 100, baos);
  data = baos.toByteArray();
  Bundle params = new Bundle();
  params.putString(Facebook.TOKEN, mFacebook.getAccessToken());
  params.putString("method", "photos.upload");
  params.putByteArray("picture", data); 


 public void postOnMyWall(Bundle params) {
 mFacebook.dialog(MainActivity.this, "feed", params, new DialogListener() {

    @Override
    public void onFacebookError(FacebookError e) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onError(DialogError e) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onComplete(Bundle values) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onCancel() {
        // TODO Auto-generated method stub

    }
});


Source: facebook

Leave a Reply