Note that there are some explanatory texts on larger screens.

plurals
  1. POUpload image from sdcard on facebook- Android
    primarykey
    data
    text
    <p>I want to upload an image from an SD card on Facebook. An image can be posted on Facebook from a URL, but it's not getting posted if I'm passing the image from the SD card.</p> <p>I am passing <code>byteArray</code> instead string for uploading image still I'm not getting the output. Can anyone please help me solve this issue?</p> <p>My code:</p> <pre><code> byte[] data = null; params.putString(Facebook.TOKEN, facebook.getAccessToken()); params.putString("link", "https://www.facebook.com/pages/My-Short-Sale-Score/242779072468511"); params.putByteArray("picture",data); Facebook facebook = new Facebook("318633718220473"); mAsyncRunner = new AsyncFacebookRunner(facebook); mAsyncRunner.request(null, params, "POST", new SampleUploadListener(), null); facebook.dialog(this, "stream.publish", params, new DialogListener() { @Override public void onComplete(Bundle values){} @Override public void onFacebookError(FacebookError error) {} @Override public void onError(DialogError e) {} @Override public void onCancel() {} } ); } public class SampleUploadListener extends BaseRequestListener { public void onComplete(final String response, final Object state) { try { // process the response here: (executed in background thread) Log.d("Facebook-Example", "Response: " + response.toString()); JSONObject json = Util.parseJson(response); final String src = json.getString("src"); // then post the processed result back to the UI thread // if we do not do this, an runtime exception will be generated // e.g. "CalledFromWrongThreadException: Only the original // thread that created a view hierarchy can touch its views." } catch (JSONException e) { Log.w("Facebook-Example", "JSON Error in response"); } catch (FacebookError e) { Log.w("Facebook-Example", "Facebook Error: " + e.getMessage()); } } @Override public void onFacebookError(FacebookError e, Object state) { } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload