Can I use inheritance in AIDL interfaces?

I want to share the interface through AIDL with client applications. I get compile time errors. Code snippet: -

interface ChildListener extends ParentListener { public void onUpdate(Class1 c1); } 

AIDL suite (all in one package) →

ChildListener.aidl . Contains the above code.

Class1.aidl . Declares Class1 as possible. The definition of class 1 is implemented in different ways.

ParentListener.aidl . Declares a ParentListener.

Errors →

I get compile-time errors (when compiling a service)

 1. syntax error don't know what to do with "extends" 2. syntax error don't know what to do with "ParentListener " 

It seems we cannot use inheritance in the AIDL interfaces? Or is it that I'm missing something here. Any pointers would be appreciated.

Best wishes

+6
source share
1 answer

You cannot use the extension when declaring a userl interface. Aidl interface has a special format. It doesn't even match the Java interface declaration.

If you indicate what you want to do, we will try to tell you how to solve the problem.

+2
source

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


All Articles