android - How can I get data from the service when the MediaPlayer is prepared? -


i developing simple music player.

this code:

    lv.setonitemclicklistener(new adapterview.onitemclicklistener() {                     @override                     public void onitemclick(adapterview<?> parent, view view, int position, long id) {                     ...                     ...                      // sb seekbar                     // musicsrv service                     // myupdater class update seekbar:                      sb.removecallbacks(mupdater);                     sb.setprogress(0);                     sb.setmax(musicsrv.getdur());                     mupdater = new myupdater(musicsrv.getmediaplayer(), sb, btplay, currenttime, totaltime, replay);                     sb.post(mupdater);                      ...                     ... 

when tap song in listview, error:

02-05 19:59:16.625  10140-10140/com.xrobot.john.musictest2 e/mediaplayer﹕ attempt call getduration without valid mediaplayer 

because, think, music player not prepared when musicsrv.getdur() called.

so, how can execute function "musicsrv.getdur()" when mediaplayer ( in service class ) prepared ?


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -