Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6879409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:50:32+00:00 2026-05-27T04:50:32+00:00

I want to Post the Photo on to the FB with Using Auth. I

  • 0

I want to Post the Photo on to the FB with Using Auth.
I want any Easy Demo Example that can Help me to Post the Photo On FB.
Can Anybudy Help me for that ?
Thanks.

With Hardik Answer i got Exception like that:

12-02 14:29:42.820: WARN/Bundle(318): Key access_token expected byte[] but value was a java.lang.String.  The default value <null> was returned.
12-02 14:29:42.850: WARN/Bundle(318): Attempt to cast generated internal exception:
12-02 14:29:42.850: WARN/Bundle(318): java.lang.ClassCastException: java.lang.String
12-02 14:29:42.850: WARN/Bundle(318):     at android.os.Bundle.getByteArray(Bundle.java:1305)
12-02 14:29:42.850: WARN/Bundle(318):     at com.facebook.android.Util.openUrl(Util.java:155)
12-02 14:29:42.850: WARN/Bundle(318):     at com.facebook.android.Facebook.request(Facebook.java:563)
12-02 14:29:42.850: WARN/Bundle(318):     at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:253)
12-02 14:29:42.850: WARN/Bundle(318): Key method expected byte[] but value was a java.lang.String.  The default value <null> was returned.
12-02 14:29:42.860: WARN/Bundle(318): Attempt to cast generated internal exception:
12-02 14:29:42.860: WARN/Bundle(318): java.lang.ClassCastException: java.lang.String
12-02 14:29:42.860: WARN/Bundle(318):     at android.os.Bundle.getByteArray(Bundle.java:1305)
12-02 14:29:42.860: WARN/Bundle(318):     at com.facebook.android.Util.openUrl(Util.java:155)
12-02 14:29:42.860: WARN/Bundle(318):     at com.facebook.android.Facebook.request(Facebook.java:563)
12-02 14:29:42.860: WARN/Bundle(318):     at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:253)
12-02 14:29:42.900: WARN/Bundle(318): Key format expected byte[] but value was a java.lang.String.  The default value <null> was returned.
12-02 14:29:42.910: WARN/Bundle(318): Attempt to cast generated internal exception:
12-02 14:29:42.910: WARN/Bundle(318): java.lang.ClassCastException: java.lang.String
12-02 14:29:42.910: WARN/Bundle(318):     at android.os.Bundle.getByteArray(Bundle.java:1305)
12-02 14:29:42.910: WARN/Bundle(318):     at com.facebook.android.Util.openUrl(Util.java:155)
12-02 14:29:42.910: WARN/Bundle(318):     at com.facebook.android.Facebook.request(Facebook.java:563)
12-02 14:29:42.910: WARN/Bundle(318):     at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:253)
12-02 14:29:44.560: INFO/global(318): Default buffer size used in BufferedOutputStream constructor. It would be better to be explicit if an 8k buffer is required.
12-02 14:29:44.560: WARN/Bundle(318): Key access_token expected byte[] but value was a java.lang.String.  The default value <null> was returned.
12-02 14:29:44.571: WARN/Bundle(318): Attempt to cast generated internal exception:
12-02 14:29:44.571: WARN/Bundle(318): java.lang.ClassCastException: java.lang.String
12-02 14:29:44.571: WARN/Bundle(318):     at android.os.Bundle.getByteArray(Bundle.java:1305)
12-02 14:29:44.571: WARN/Bundle(318):     at com.facebook.android.Util.encodePostBody(Util.java:63)
12-02 14:29:44.571: WARN/Bundle(318):     at com.facebook.android.Util.openUrl(Util.java:182)
12-02 14:29:44.571: WARN/Bundle(318):     at com.facebook.android.Facebook.request(Facebook.java:563)
12-02 14:29:44.571: WARN/Bundle(318):     at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:253)
12-02 14:29:44.571: WARN/Bundle(318): Key method expected byte[] but value was a java.lang.String.  The default value <null> was returned.
12-02 14:29:44.580: WARN/Bundle(318): Attempt to cast generated internal exception:
12-02 14:29:44.580: WARN/Bundle(318): java.lang.ClassCastException: java.lang.String
12-02 14:29:44.580: WARN/Bundle(318):     at android.os.Bundle.getByteArray(Bundle.java:1305)
12-02 14:29:44.580: WARN/Bundle(318):     at com.facebook.android.Util.encodePostBody(Util.java:63)
12-02 14:29:44.580: WARN/Bundle(318):     at com.facebook.android.Util.openUrl(Util.java:182)
12-02 14:29:44.580: WARN/Bundle(318):     at com.facebook.android.Facebook.request(Facebook.java:563)
12-02 14:29:44.580: WARN/Bundle(318):     at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:253)
12-02 14:29:44.613: WARN/Bundle(318): Key format expected byte[] but value was a java.lang.String.  The default value <null> was returned.
12-02 14:29:44.650: WARN/Bundle(318): Attempt to cast generated internal exception:
12-02 14:29:44.650: WARN/Bundle(318): java.lang.ClassCastException: java.lang.String
12-02 14:29:44.650: WARN/Bundle(318):     at android.os.Bundle.getByteArray(Bundle.java:1305)
12-02 14:29:44.650: WARN/Bundle(318):     at com.facebook.android.Util.encodePostBody(Util.java:63)
12-02 14:29:44.650: WARN/Bundle(318):     at com.facebook.android.Util.openUrl(Util.java:182)
12-02 14:29:44.650: WARN/Bundle(318):     at com.facebook.android.Facebook.request(Facebook.java:563)
12-02 14:29:44.650: WARN/Bundle(318):     at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:253)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:50:32+00:00Added an answer on May 27, 2026 at 4:50 am

    hi first Download Facebook SDK..

    Facebook SDK

    then in Oncreate method

    //for Authonticaion

    public class FacebollAppforPhotoUpload extends Activity {
    
     //------------------FB-------------------------
    
    
    Facebook facebook = new Facebook("APP_KEY");
    String permissions[] = {""};
     String statusString = "";
    
     //---------------------------------------------
    
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    
    
    
    
        statusString="testing Post For Application Development";
    
    
        setContentView(R.layout.main);
    
         facebook.authorize(this, permissions, new DialogListener() {
            @Override
            public void onComplete(Bundle values) {
    
    
            //  updateStatus(values.getString(Facebook.TOKEN));
                uploadphoto(values.getString(Facebook.TOKEN));
    
                finish();
    
            }
    
    
            @Override
            public void onFacebookError(FacebookError error) {}
    
            @Override
            public void onError(DialogError e) {}
    
            @Override
            public void onCancel() {
    
                finish();
    
            }
        });
    

    Phhot upload method

    public void uploadphoto(String accessToken)
    {
        byte[] data = null;
    
        ContentResolver cr = FacebollAppforPhotoUpload.this.getContentResolver();
       // InputStream fis = cr.openInputStream(localSnapshotUri);
        Bitmap bi = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        bi.compress(Bitmap.CompressFormat.JPEG, 100, baos);
        data = baos.toByteArray();    
    
    
    
        Bundle params = new Bundle();
        params.putString("method", "photos.upload");
        params.putByteArray("picture", data);
    
        AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
        mAsyncRunner.request(null, params, "POST", new RequestListener(){
    
            @Override
            public void onComplete(String response, Object state) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onIOException(IOException e, Object state) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onFileNotFoundException(FileNotFoundException e,
                    Object state) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onMalformedURLException(MalformedURLException e,
                    Object state) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onFacebookError(FacebookError e, Object state) {
                // TODO Auto-generated method stub
    
            }},null);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to post on twitter wall but don't want that user can edit
I want to create user profile with image. That user can upload his photo,
I want to post a message on the user's facebook wall using access token.
I created a NSEvent and I want to post it. How can I do
I want to post a photo (stored in appengine db) to facebook. To test
I want to post a status update to my feed and add a photo
I'm creating a photo tagging project using mysql and php, that not only just
In this post: Using of PhotoChooserTask I have found out that it is possible
I'm trying to post a photo using mikeal request library, but the post comes
In My Appplication i am using this code to post the photo on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.