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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:58:28+00:00 2026-05-26T20:58:28+00:00

I just need to know how to play this below link in android…i tried

  • 0

I just need to know how to play this below link in android…i tried it in emulator its working but not on device why…..Help is appreciated……

   http://stream.radiosai.net:8002/
  • 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-26T20:58:29+00:00Added an answer on May 26, 2026 at 8:58 pm

    Already i have implemented play streaming audio in my app.Directly i paste this code here .Remove unnecessary data and use it.i have tested your link in it ,is working for me.

    import java.io.IOException;
    
    import android.app.Activity;
    import android.app.ProgressDialog;
    import android.graphics.drawable.AnimationDrawable;
    import android.media.AudioManager;
    import android.media.MediaPlayer;
    import android.media.MediaPlayer.OnBufferingUpdateListener;
    import android.media.MediaPlayer.OnErrorListener;
    import android.media.MediaPlayer.OnInfoListener;
    import android.media.MediaPlayer.OnPreparedListener;
    import android.os.Bundle;
    import android.os.Handler;
    import android.os.Message;
    import android.widget.CompoundButton;
    import android.widget.CompoundButton.OnCheckedChangeListener;
    import android.widget.ImageView;
    import android.widget.ToggleButton;
    
    public class StreamAudio extends Activity implements OnPreparedListener,
             OnErrorListener {
    
        MediaPlayer mp;
        private ToggleButton btn;
        private ImageView img;
        private boolean flag = false;
        AnimationDrawable frameAnimation;
        ProgressDialog progress;
    
    
         String url="http://stream.radiosai.net:8002/";
    
        @Override
        public void onCreate(Bundle icicle) {
            super.onCreate(icicle);
            setContentView(R.layout.main);
    
            btn = (ToggleButton) findViewById(R.id.play);
            img = (ImageView) findViewById(R.id.radio_image);
    
            img.setBackgroundResource(R.drawable.frames);
            frameAnimation = (AnimationDrawable) img.getBackground();
    
            mp = new MediaPlayer();
    
            progress=ProgressDialog.show(this, null ,"Loading...",false,true);
    
            Runnable r=new Runnable() {
    
                @Override
                public void run() {
                    setPlayBack();
                }
            };
            Thread th=new Thread(r);
            th.start();
                mp.setOnPreparedListener(this);
                //mp.setOnBufferingUpdateListener(this);
                mp.setOnErrorListener(this);
            //  mp.setOnInfoListener(this);
                btn.setOnCheckedChangeListener(new OnCheckedChangeListener() {
    
                    @Override
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    
                        if(flag)
                        {
    
                            if(!isChecked)
                            {
                                    btn.setBackgroundResource(R.drawable.btn_stop);
                                    mp.start();
                                    frameAnimation.start();
                            }
    
                            else
                            {
                                btn.setBackgroundResource(R.drawable.btn_play);
                                frameAnimation.stop();
                                mp.stop();
                                mp.reset();
                                flag=false;
                            }
                        }
                        else
                        {
                            btn.setChecked(false);
    
                            progress=ProgressDialog.show(StreamAudio.this, null ,"Loading...",false,false);
                            Runnable r=new Runnable() {
    
                                @Override
                                public void run() {
                                    // TODO Auto-generated method stub
                                    setPlayBack();
                                }
                            };
                            Thread th=new Thread(r);
                            th.start();
                        }
    
                    }
                });
        }
    
        @Override
        protected void onDestroy() {
    
            super.onDestroy();
            mp.release();
    
        }
    
        @Override
        public void onPrepared(MediaPlayer mp) {
    
            flag = true;
            handler.sendEmptyMessage(0);
        }
    
    
        @Override
        public boolean onError(MediaPlayer mp, int what, int extra) {
    
            mp.release();
            return false;
        }
            private void setPlayBack()
            {
                mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
                    try {
                        mp.setDataSource(url);
                    } catch (IllegalArgumentException e1) {
                        e1.printStackTrace();
                    } catch (IllegalStateException e1) {
                        e1.printStackTrace();
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                    mp.prepareAsync();
            }
            private Handler handler=new Handler(){
                @Override
                public void handleMessage(Message msg) {
                    progress.dismiss();
                    btn.setBackgroundResource(R.drawable.btn_stop);
                    frameAnimation.start();
                    mp.start();
                }
            };
    }
    

    main.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    
    
        <LinearLayout android:layout_alignParentBottom="true"
            android:gravity="center" android:layout_width="fill_parent"
            android:background="@drawable/bottom_bar" android:layout_height="wrap_content">
    
            <ToggleButton android:background="@drawable/btn_stop" android:checked="false" android:id="@+id/play" android:textOff="" android:textOn=""
                android:layout_width="wrap_content" android:layout_height="wrap_content"></ToggleButton>
        </LinearLayout>
        <ImageView android:id="@+id/radio_image"
            android:layout_height="wrap_content" android:layout_width="wrap_content"
            android:layout_centerInParent="true"></ImageView>
    
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have solved this problem, I just need to know what to do. I
Seems so basic, I can't believe I don't know this! I just need a
The example below, is just an example, I know that I don't need an
I just need some advice. I already know how to play with bash, ruby,
I just need to know if WCF is platform independent like Webservices? Can the
I just need to know hot to create a CGLayer that has an image
NOTE: I am aware of the SVN relocate switch, I just need to know
I know this questions has been asked a few times here. But these seem
Alright, I know I've asked similar questions, but I feel this is hopefully a
I'm currently working on a project in which i need to play a background

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.