Hello to ereryone
I want to call Brodcast Receiver from my main activity when it satisfy the
particular condition. How can i achieve this ?
Please help to find this solution . Please give me proper example for that.
Example
---
if(condition)
{
Here i want to call broadcast receiver
You cant call a Broadcast Receiver from a class. Its called automatically
when it receives the matching Broadcast.
if you have written a piece of code inside an existing BroadcastReceiver,
then port it to a class and use this class in your BroadcastReceiver as well
as in your Activity.
Regards,
You could also use sendBroadcast() from your Activity, which will trigger
your BR. However, this might have more implication with respect to
synchronous operation. I believe the sendBroadcast would be asynchronous and
your BR will not execute immediately.
Otherwise, I suggest doing what
3 matches
Mail list logo