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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:55:15+00:00 2026-06-01T22:55:15+00:00

My ProgressDialog will not show up. In my program the user selects bitrate from

  • 0

My ProgressDialog will not show up. In my program the user selects bitrate from a pop up menu, the content is fetched online and displayed in VideoView.

However, all I get is a black screen while the video loads and the progressDialog is display for a split second (or less) at end before the video finally loads.

  private void showPopupMenu(View v){
   popupMenu = new PopupMenu(VideoPlayer.this, v); 
   if(bitRates != null){
       int menuItem = 0;
       int index = bitRates.size()-1;
       popupMenu.getMenu().add(0,menuItem, 0,"Hide menu");
          for(int i=1;i<bitRates.size();i++){
              menuItem = i;

              popupMenu.getMenu().add(0,menuItem, 0,"Quality"+" : "+bitrateCheck(bitRates.get(index))).setCheckable(true);
              Log.i("ITEM",qualityList.get(i)+" : "+bitRates.get(i));
              index--;
          }
          popupMenu.getMenu().add(0,menuItem++, 0,"Catalog");

      }
  popupMenu.show(); 
  popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

   public boolean onMenuItemClick(final MenuItem item) {
        p_dialog = ProgressDialog.show(VideoPlayer.this, "", "Loading...");

       //get current position of video to seek to
       final int position = mVideoView.getCurrentPosition();
       new Thread() {

            public void run() {

                try{

                    runOnUiThread(new Runnable() {
                        public void run() {

                            if(item.getTitle().equals("Catalog")){
                                 backButtonVideo(new View(VideoPlayer.this));
                            }
                            else if(item.getTitle().equals("Hide menu")){
                                popupMenu.dismiss();
                                mVideoView.start();                             
                            }
                            else{
                                play(streamUrls.get(item.getItemId()),position);

                            }
                        }
                    });


                }
                catch (Exception e) {
                    Log.e("tag", e.getMessage());

                }
                p_dialog.dismiss();
            }

        }.start();

       return true;

   }
  });

}


 public void play(String _videoUri, int position){
         Log.i(TAG,"URI is : "+Uri.parse(_videoUri).toString());         
         //View view = new View()
         MediaController mc = new MediaController(VideoPlayer.this);
         mVideoView.setMediaController(mc); 
         mVideoView.setVideoURI(Uri.parse(_videoUri));
         mVideoView.requestFocus();
         mVideoView.seekTo(position);
         mVideoView.start();

  }

////////////////////////Edit with new Code: as per suggestions/////////////////////
Now the dialog does not show at all.

     mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {

    public void onPrepared(MediaPlayer mp) {
        // TODO Auto-generated method stub  
        mVideoView.start();

    }
});

///////////////////////////////////////////////////////////////////////////////////

  popupMenu.show(); 
  popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

   public boolean onMenuItemClick(final MenuItem item) {       
       //get current position of video to seek to
       final int position = mVideoView.getCurrentPosition();
       p_dialog = ProgressDialog.show(VideoPlayer.this, "", "Loading...");
       try{
            if(item.getTitle().equals("Catalog")){
                backButtonVideo(new View(VideoPlayer.this));
            }
            else if(item.getTitle().equals("Hide menu")){
                popupMenu.dismiss();
                mVideoView.start();                             
            }
            else{
                play(streamUrls.get(item.getItemId()),position);                            
            }

        }
        catch (Exception e) {Log.e("tag", e.getMessage());}  
       return true;  
   }
  });

 }


  public void play(String _videoUri, int position){
         Log.i(TAG,"URI is : "+Uri.parse(_videoUri).toString());         
         MediaController mc = new MediaController(VideoPlayer.this);
         mVideoView.setMediaController(mc); 
         mVideoView.setVideoURI(Uri.parse(_videoUri));
         mVideoView.requestFocus();
         mVideoView.seekTo(position);
         p_dialog.dismiss();
  }
  • 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-06-01T22:55:16+00:00Added an answer on June 1, 2026 at 10:55 pm

    Firstly, it makes no sense to create a separate thread only to run something back on the UI thread (why do you create the thread in the first place then?).

    onMenuItemClick should already be called by the UI thread (callbacks for UI elements generally do this).

    What you should look at is using a MediaPlayer.OnPreparedListener with VideoView.setOnPreparedListener. This will give you an indication of when the video is ready to be played.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to test an Activity in android which will show a ProgressDialog and
ProgressDialog onClick not working.. here is my code .. Basically i want to show
Edit: this is NOT the same as ProgressDialog doesn't show just flashes I make
I want to show ProgressDialog while uithread sleeps so that until the data from
My program uses wx.ProgressDialog to give feedback on a process that is in multiple
I've developed a simple asynctask with progressdialog attached to it, to show progress of
I have the following structure: in UIActivity1: MyMyProgressDialogFragment progressDialog = MyMyProgressDialogFragment.newInstance(); progressDialog.show(getFragmentManager(),dialog); getFragmentManager().executePendingTransactions(); ..do
I'm prototyping an ftp utility that will save a user's progress, and re-upload a
I'm making an Android app where the user can download files from a FTP-server.
I want ProgressDialog to show while my code enables WiFi and connects to a

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.