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

  • Home
  • SEARCH
  • 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 9159603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:32:01+00:00 2026-06-17T13:32:01+00:00

I am playing an stream from Internet and because long processes such as network

  • 0

I am playing an stream from Internet and because long processes such as network operation should not be handled on UI Thread, I’m using AsyncTask.
In Main Thread I set some specification of videoView:

public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.videoview);
    progressDialog = ProgressDialog.show(this, "Loading", "Please Wait", true, true);

    videoView = (VideoView) findViewById(R.id.surface_view);
    videoView.setVideoPath(ChannelPath);
    videoView.setMediaController(new MediaController(this));

    new LoadStream().execute("");
}

And in AsyncTask I start the video:

private class LoadStream extends AsyncTask<String, Void, Void> {
    protected Void doInBackground(String... urls) {
            videoView.setOnPreparedListener(new OnPreparedListener() {
                public void onPrepared(MediaPlayer mp) {
                    videoView.start();
                    progressDialog.dismiss();
                }
            });
        return null;
    }
}

I tried to have all the parts related to videoView on AsyncTask but was unable to setVideoPath and setMediaController on AsyncTask.
I am wondering which part is exactly the time consuming part? Is my code alright? or I’m still having the long process on UI Thread?

  • 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-17T13:32:02+00:00Added an answer on June 17, 2026 at 1:32 pm

    You donot need to use Async Task for this. Use only ProgressDialog progressBar = ProgressDialog.show(context, "", "Loading Records, Please Wait..", true); and dissmiss this progressBar in onPrepared method.

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

Sidebar

Related Questions

I'm working on playing audio from an audio stream using VC++ with the QtMultimedia
I'm using AForgeNet to grab playing cards from a video stream. I grab the
im playing an rtmp stream using netConnection and netStream of flash as 2.0. The
I am trying to make Quicktime files stream from a HTML document using the
I have some Android code to stream an audio file from the internet and
I have some Android code to stream an audio file from the internet and
I want to stream an audio from server using windows phone 7 the audio
Are there any tutorials that discuss how to stream audio from the Internet to
I am using AudioQueue to stream audio from an arbitrary source (the class basically
I'm successfully using AVPlayer to stream audio from a server and what I want

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.