tags:

views:

24

answers:

2

How i can share a image from from my app to facebook in android?

+1  A: 
public void shareOnFacebook() {
    Uri uri = Uri.parse("http://m.facebook.com/sharer.php?u=" +
            website_url + "&t="+ someTitle.replaceAll(" ","+");
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    startActivity(intent);
}

where your website should hold a meta tag like

<link rel="image_src" type="image/jpeg" href="http://www.domain.com/someimage.jpg" />

which will then be used on Facebook as the promo image. Of course this can also be done dynamically on server side.

This is the approach where you use an image that's also on a server somewhere already, so you don't need to send it from your Android device to a server first. Depending on your use case, but this is usually the easiest way.

Mathias Lin