Android - Using method from a Service in an Activity?

后端 未结 3 1485
庸人自扰
庸人自扰 2020-12-07 15:06

I have the folowing method in a Service in my appplication:

public void switchSpeaker(boolean speakerFlag){

        if(speakerFlag){
        audio_service.s         


        
3条回答
  •  旧时难觅i
    2020-12-07 15:18

    You have to expose service`s switchSpeaker method for clients. Define your .aidl file. Than bind to that service from your activity and simply call switchSpeaker. See documentation

    No other simple way to call this method, only if it static)

提交回复
热议问题