Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>facebook.authorize(FbdemoActivity.this, new String[]{ "user_photos,publish_checkins,publish_actions,publish_stream"},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 void postImageonWall() { byte[] data = null; Bitmap bi = BitmapFactory.decodeFile("/sdcard/viewitems.png"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); bi.compress(Bitmap.CompressFormat.JPEG, 100, baos); data = baos.toByteArray(); Bundle params = new Bundle(); params.putString(Facebook.TOKEN, facebook.getAccessToken()); params.putString("method", "photos.upload"); params.putByteArray("picture", data); AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook); mAsyncRunner.request(null, params, "POST", new SampleUploadListener(), null); } 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) { // TODO Auto-generated method stub } } </code></pre> <p>here is the whole code try it it will definately work for you and it is work for me also</p>
 

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