Search code examples
javaandroidandroid-intentbroadcastreceiver

Using an Android Intent to call a method, instead of a class?


I have seen questions similar to my issue on this forum but none that answer directly.

Essentially I have a broadcast receiver listening for an android action, the receiver is registered within one of my classes and, currently, calls a class. I would like for it to call a method within that class, without creating a second broadcast receiver (it seems pretty inefficient and poor coding practice to do so).

A lot of people have mentioned simply creating a broadcast receiver for that class but I don't want to use a broadcast receiver to call another broadcast receiver, any ideas?


Solution

  • Why don't you call the method from the same broadcast receiver, where you have registered that receiver.