url - Trying to stream mp3 from server to my app -


i tried play music web app when launch actifity app crashes. eclipse doesn't find errors. can code , maybe find problem? thank in advance.

package daanklijn.music;  import java.io.ioexception;  import pcsalt.example.customlistviewdemo2.r; import android.app.activity; import android.media.audiomanager; import android.media.mediaplayer; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.toast; import android.app.actionbar; import android.app.fragment; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.viewgroup; import android.os.build;  public class afrojackactivity extends activity {  static mediaplayer mplayer; button buttonplay; button buttonstop; string url = "http://android.programmerguru.com/wp-content/uploads/2013/04/hosannatelugu.mp3";   @override public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_afrojack);      buttonplay = (button) findviewbyid(r.id.play);     buttonplay.setonclicklistener(new onclicklistener() {          public void onclick(view v) {             mplayer = new mediaplayer();             mplayer.setaudiostreamtype(audiomanager.stream_music);             try {                 mplayer.setdatasource(url);             } catch (illegalargumentexception e) {                 toast.maketext(getapplicationcontext(), "you might not set uri correctly!", toast.length_long).show();             } catch (securityexception e) {                 toast.maketext(getapplicationcontext(), "you might not set uri correctly!", toast.length_long).show();             } catch (illegalstateexception e) {                 toast.maketext(getapplicationcontext(), "you might not set uri correctly!", toast.length_long).show();             } catch (ioexception e) {                 e.printstacktrace();             }             try {                 mplayer.prepare();             } catch (illegalstateexception e) {                 toast.maketext(getapplicationcontext(), "you might not set uri correctly!", toast.length_long).show();             } catch (ioexception e) {                 toast.maketext(getapplicationcontext(), "you might not set uri correctly!", toast.length_long).show();             }             mplayer.start();         }     });      buttonstop = (button) findviewbyid(r.id.stop);     buttonstop.setonclicklistener(new onclicklistener() {          public void onclick(view v) {             // todo auto-generated method stub             if(mplayer!=null && mplayer.isplaying()){                 mplayer.stop();             }         }     }); }  protected void ondestroy() {     super.ondestroy();     // todo auto-generated method stub     if (mplayer != null) {         mplayer.release();         mplayer = null;     } }  } 

add '}' in wrong place, after changing worked.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -