Is there a way to define a protocol class in Android?

I am new to Android and have been working on iOS for the longest time. Just ask the basic question regarding the protocol class. Here is my protocol class in iOS:

#import "ServiceBaseProtocol.h" #import "ServiceTasksProtocol.h" @protocol AnswersServiceProtocol <ServiceBaseProtocol> - (NSUInteger)answersQueryIntentForTarget:(id<ServiceTaskCallbackProtocol>)target requestInput:(NSString*)requestInput; @end 

Is it possible to convert this to equivalent android code. How do I get along?

+4
source share
1 answer

Protocols are called interfaces in Java. So your code snippet might look like this:

  public interface AnswersServiceProtocol extends ServiceBaseProtocol { public int answersQueryIntentForTargetAndRequestInput(ServiceTaskCallbackProtocol target, String requestInput); } 
+5
source

Source: https://habr.com/ru/post/1496884/


All Articles