# Create AILD interfaces

In case of callback AIDL, in addition to `ICalculator.aidl` file, we also need to create another `ICalculatorCallback.aidl`

* [x] Create Callback interface

```java
// ICalculatorCallback.aidl
package com.tejpratapsingh.aildlib;

import com.tejpratapsingh.aildlib.ICalculatorCallback;
// Declare any non-default types here with import statements

interface ICalculatorCallback {
    /**
     * Demonstrates some basic types that you can use as parameters
     * and return values in AIDL.
     */
    void onAdded(int result);
}
```

* [x] Create main `aidl` which will register the callback interface.

```java
// ICalculator.aidl
package com.tejpratapsingh.aildlib;

import com.tejpratapsingh.aildlib.ICalculatorCallback;

// Declare any non-default types here with import statements

interface ICalculator {
    /**
     * Demonstrates some basic types that you can use as parameters
     * and return values in AIDL.
     */
    void registerListener(ICalculatorCallback cb);
    void unRegisterListener(ICalculatorCallback cb);

    void add(int a, int b);
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.tejpratapsingh.com/_/android-tips/aidl/aidl-with-callback/create-aild-interfaces.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
