How can I post an image with text on facebook? I know how to post text, links, but I want to post an image as well.
Here is what I have tried:
byte[] data = null;
Bitmap bi = BitmapFactory.decodeFile("R.drawable.plate1");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bi.compress(Bitmap.CompressFormat.JPEG, 100, baos);
data = baos.toByteArray();
parameters.putByteArray("picture", data);
int plate = getResources().getIdentifier("com.b2creativedesigns.eyetest:drawable/plate1", null, null);
parameters.putString("picture", String.valueOf(plate));
Neither of them works. When I try to post, nothing happens. Nothing is posted. With the code below, it works.
Posting the image from a website is easy, but it will not work, when the website gets shutdown or the links modified.
parameters.putString("picture", "https://lh3.ggpht.com/f79UCpnLisZxO2P2C43f55YLvFpNco_cTcC-t9Ck-Qmqe5jwKbfnUvCh5N6-Te-mOw=w124");
3rd example:
byte[] data = null;
Bitmap bi = BitmapFactory.decodeFile("R.drawable.plate1");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bi.compress(Bitmap.CompressFormat.JPEG, 100, baos);
data = baos.toByteArray();
parameters.putString("method", "photos.upload");
parameters.putByteArray("picture", data);