How to call a method in activity from a service

前端 未结 4 763
失恋的感觉
失恋的感觉 2020-12-08 07:14

There is a service that listens for some voice. If voice matches a string a certain method is invoked in the service object.

public class SpeechActivationSe         


        
4条回答
  •  渐次进展
    2020-12-08 07:38

    I would register a BroadcastReceiver in the Activity and send an Intent to it from the service. See this tutorial: http://www.vogella.com/articles/AndroidBroadcastReceiver/article.html It might look a bit long but you'll want to learn how to use those anyway ;)

提交回复
热议问题