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
Post a Comment