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 6555489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:49:35+00:00 2026-05-25T12:49:35+00:00

I am posting something to FB from my program. Works great except that I

  • 0

I am posting something to FB from my program.
Works great except that I want to show a ProgressDialog before and then an AlertDialog after.

For some reason the ProgressDialog doesn’t appear at all whereas the AlertDialog does but the execution of the code continues through and doesn’t “wait”.

private void uploadToFB(){
    if (settings.getCurrentUploadToFB()){

        ProgressDialog progressDialog = ProgressDialog.show(this, "Posting to Facebook", "Please wait ...", true);
        Bundle parameters = new Bundle();
        parameters.putString("link","https://market.android.com/details?id=il.co.anykey.games.yaniv.lite&feature=search_result");
        parameters.putString("picture","http://www.anykey.co.il/images/launcher_yaniv.png");
        parameters.putString("name","YanivLite on Android");
        parameters.putString("caption","Can you beat my score?");
        parameters.putString("description","I scored "+ ScoringForScoreloop.getScore() + " in YanivLite on Android. Can you beat my score?");
        facebookConnector.postMessageOnWall(parameters);

        final AlertDialog alertDialog = new AlertDialog.Builder(this).create();

        alertDialog.setTitle(R.string.uploadedToFacebookTitle);
            ScoringForScoreloop.addAssafedScore();
            alertDialog.setMessage(getString(R.string.uploadedToFacebookMessage));   


        alertDialog.setButton(DialogInterface.BUTTON_POSITIVE,getString(R.string.ok), new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {            
                   try {
                    alertDialog.dismiss();
                    finishGame();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
                   return;
        } });
        alertDialog.setCancelable(false);  // prevent use of back button which would skip the listener
        alertDialog.show();
    }
    else
        finishGame();

}
  • 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-25T12:49:36+00:00Added an answer on May 25, 2026 at 12:49 pm

    try this class

    private void uploadToFB(){
        if (settings.getCurrentUploadToFB())
             new PostBackground.execute();
        else
             finish();
    }
    
    private class PostBackground extends AsyncTask<Void, Void, Void>{
        private ProgressDialog progressDialog;
        public void doInBackgound(Void...obj){
             publishUpdate();
             Bundle parameters = new Bundle();
            parameters.putString("link","https://market.android.com/details?id=il.co.anykey.games.yaniv.lite&feature=search_result");
            parameters.putString("picture","http://www.anykey.co.il/images/launcher_yaniv.png");
            parameters.putString("name","YanivLite on Android");
            parameters.putString("caption","Can you beat my score?");
            parameters.putString("description","I scored "+ ScoringForScoreloop.getScore() + " in YanivLite on Android. Can you beat my score?");
            facebookConnector.postMessageOnWall(parameters);
    
        }
    
        public void postUpdate(Void arg){
            progressDialog = ProgressDialog.show(this, "Posting to Facebook", "Please wait ...", true);
        }
    
       public void postExecute(Void result){
            if(progressDialog!=null)
                  progressDialog.dismiss();
    
            progressDialog = null;
            final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    
        alertDialog.setTitle(R.string.uploadedToFacebookTitle);
            ScoringForScoreloop.addAssafedScore();
            alertDialog.setMessage(getString(R.string.uploadedToFacebookMessage));   
    
    
        alertDialog.setButton(DialogInterface.BUTTON_POSITIVE,getString(R.string.ok), new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {            
                   try {
                    alertDialog.dismiss();
                    finishGame();
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
                   return;
        } });
        alertDialog.setCancelable(false);  // prevent use of back button which would skip the listener
        alertDialog.show();
    
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before posting to another page from my center frame, I want to remove the
After posting this question and reading that one I realized that it is very
Before posting my question, I would like to tell you that I have no
I'm posting data from a Flex app to a php script. GET works fine
I want to disallow proxies and spambots from posting in my website. What is
I honestly tried to do search before posting but couldn't find something specific. So
In another question , I asked something similar but I ended up just posting
Posting this one for a friend. They have an Icefaces app that uses Icefaces's
before posting the whole code, i wanted to make sure I am not missing
I'm posting some info to a user's wall via Facebook Connect (from my external

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.