I'm developing an app that requires the use of Bluetooth. The issue is that I have several activities that use the Bluetooth communication and I'm creating a class that makes the communication. For that, I need to resend the result to the activity. I'm trying to implement the activity like this:
public abstract class MyCommunicationActivity extends Activity {
public static class MYHANDLER extends Handler{};
}
I want to to force every activity to create a HANDLER that handles the response from the communication class and this class will receive an object MyCommunication class so it knows that the activity will wave a subclass that is a handler to handle the result. I've did it like this, but my sub classes (those that extend MyCommunicationActivity) aren't being force to implement the handler.
How can I do this? Is it possible?
Add a method like this:
public abstract Handler getHandler();
This will force all subclasses to implement getHandler()
and return a Handler there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With