原文网址:http://stackoverflow.com/questions/4883079/usage-of-sendbroadcast
sendBroadcast() - Should it be called inside Activity? I am trying to call sendBroadcast() from my method of utility-class which doesn‘t extend Activity. I am getting compilation error as below
Here is the code snippet:
Is there any concept behind using sendBroadcast call inside my class. There is no issue in using sendBroadcast() inside Activity. Can someone here help me to resolve it? Or Any other suggestions are invited to return data from utility class to application asynchronously. Thanks in advance. |
|||||
|
2 Answers
up vote15down vote |
You should pass the context from activity class to utility class to access the specific application resources like startActivity, sendBroadcast, etc.
|