ClassCastException: android.os.Handler$MessengerImpl cannot be cast to My -
i have declared handler
in service
:
final messenger messenger = new messenger(new musicapicontrolhandler()); public class musicplayerbinder extends binder { public musicplayerservice getservice() { return musicplayerservice.this; } } @override public ibinder onbind(intent intent) { return messenger.getbinder(); } public class musicapicontrolhandler extends handler { @override public void handlemessage(message msg) { // } }
in class implements serviceconnection
, binds service
, following:
@override public void onserviceconnected(componentname componentname, ibinder ibinder) { handler = (musicplayerservice.musicapicontrolhandler) ibinder; }
my problem is, classcastexception
when try cast binder handler
, should instance of because it´s set binder of messenger.
where going wrong?
i have not declared service process
Comments
Post a Comment