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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:00:42+00:00 2026-05-23T02:00:42+00:00

I’m building an Android app that will stream several radio stations from a Latin

  • 0

I’m building an Android app that will stream several radio stations from a Latin Country, there is like 10 stations that I know can be played in android, I got the URL’s from them and actually made them work using this tutorial (link removed, because it is dead) but the problem I have is that it plays for several seconds and then stops it keeps loading but does not restart the streaming, my questions:

  • If someone has worked with this tutorial can explain me how to make it stream constantly with out stopping.
  • Is there an easier way to stream radio audio? this tutorial seems kind of old, is there a newer tutorial or a newer code sample to study or use?
  • Can someone send me the right way?
  • 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-23T02:00:42+00:00Added an answer on May 23, 2026 at 2:00 am

    So I found this sample and it works for me, here it is if you have the same issue:

    in myMain.java

    import android.app.Activity;
    import android.os.Bundle;
    
    import java.io.IOException;
    
    import android.media.MediaPlayer;
    import android.media.MediaPlayer.OnBufferingUpdateListener;
    import android.media.MediaPlayer.OnPreparedListener;
    import android.util.Log;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.ProgressBar;
    
    public class myMain extends Activity implements OnClickListener {
    
        private ProgressBar playSeekBar;
    
        private Button buttonPlay;
    
        private Button buttonStopPlay;
    
        private MediaPlayer player;
    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            initializeUIElements();
    
            initializeMediaPlayer();
        }
    
        private void initializeUIElements() {
    
            playSeekBar = (ProgressBar) findViewById(R.id.progressBar1);
            playSeekBar.setMax(100);
            playSeekBar.setVisibility(View.INVISIBLE);
    
            buttonPlay = (Button) findViewById(R.id.buttonPlay);
            buttonPlay.setOnClickListener(this);
    
            buttonStopPlay = (Button) findViewById(R.id.buttonStopPlay);
            buttonStopPlay.setEnabled(false);
            buttonStopPlay.setOnClickListener(this);
    
        }
    
        public void onClick(View v) {
            if (v == buttonPlay) {
                startPlaying();
            } else if (v == buttonStopPlay) {
                stopPlaying();
            }
        }
    
        private void startPlaying() {
            buttonStopPlay.setEnabled(true);
            buttonPlay.setEnabled(false);
    
            playSeekBar.setVisibility(View.VISIBLE);
    
            player.prepareAsync();
    
            player.setOnPreparedListener(new OnPreparedListener() {
    
                public void onPrepared(MediaPlayer mp) {
                    player.start();
                }
            });
    
        }
    
        private void stopPlaying() {
            if (player.isPlaying()) {
                player.stop();
                player.release();
                initializeMediaPlayer();
            }
    
            buttonPlay.setEnabled(true);
            buttonStopPlay.setEnabled(false);
            playSeekBar.setVisibility(View.INVISIBLE);
        }
    
        private void initializeMediaPlayer() {
            player = new MediaPlayer();
            try {
                player.setDataSource("http://usa8-vn.mixstream.net:8138");
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (IllegalStateException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
    
            player.setOnBufferingUpdateListener(new OnBufferingUpdateListener() {
    
                public void onBufferingUpdate(MediaPlayer mp, int percent) {
                    playSeekBar.setSecondaryProgress(percent);
                    Log.i("Buffering", "" + percent);
                }
            });
        }
    
        @Override
        protected void onPause() {
            super.onPause();
            if (player.isPlaying()) {
                player.stop();
            }
        }
    }
    

    in the XML (main.xml) code:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:text="Source: (Radio La Chevere)"
            android:layout_marginTop="10dip" android:gravity="center" />
    <ProgressBar android:id="@+id/progressBar1"
            android:indeterminateOnly="false" android:progressDrawable="@android:drawable/progress_horizontal"
            android:indeterminateDrawable="@android:drawable/progress_indeterminate_horizontal"
            android:minHeight="20dip" android:maxHeight="20dip"
            android:layout_width="fill_parent" android:layout_height="wrap_content"
            android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
            android:layout_marginTop="10dip"></ProgressBar>
    <LinearLayout android:id="@+id/linearLayout1"
            android:layout_height="wrap_content" android:layout_width="match_parent"
            android:layout_marginTop="20dip" android:gravity="center">
            <Button android:text="Play" android:id="@+id/buttonPlay"
                    android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
            <Button android:text="Stop" android:id="@+id/buttonStopPlay"
                    android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    </LinearLayout>
    </LinearLayout>
    

    and the android manifest:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="package.your.RadioStream"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="8" />
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".myMain"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    
    </application>
    

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

Sidebar

Related Questions

No related questions found

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.