Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Evan Dix
1,641 PointsCreating a streaming from web radio app!!
I want to make an android app that is a radio. There is a online url that streams the station that i want to use. How do i do this??
Evan Dix
1,641 PointsMediaPlayer mPlayer; String radio;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my);
radio = "http://s26.myradiostream.com:9406/listen.pls";
mPlayer.setDataSource(this , Uri.parse(radio));
} }
I am trying to stream the music from this url. I set up a media player and when i go to "setDataSource" it asks for (context, and Uri uri)...what am i doing wrong. I parsed the string to a uri. Am i going in the right direction? what should i do?!?!
Evan Dix
1,641 PointsYes Ken! exactly, but i am new to this stuff and dont really know if im doing this correctly. could you help me out please?
1 Answer
Evan Dix
1,641 PointsYes! exactly. but streaming from a single url. it is a pls file.
Ken Alger
Treehouse TeacherKen Alger
Treehouse TeacherEvan;
Are you basically looking to make a single station Pandora type App?
Ken