I have a custom module of Android NativeBannerView
intent that when clicking on a button delegate the assigned action of the project, I do not master the topic of interfaces, callbacks
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/smart_banner"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:minHeight="@dimen/banner_height">
<ImageView
android:id="@+id/banner"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/banner_content"
android:foreground="@drawable/ripple"
android:src="@android:color/darker_gray" />
<Button
android:id="@+id/btn_close"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/ic_cancel_dark" />
</RelativeLayout>
Inside the module I detect the click:
Button btnCloseBanner = (Button) findViewById(R.id.btn_close);
if (btnCloseBanner != null) {
btnCloseBanner.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//delegar funcionalidad asignada desde el proyecto
}
});
}
In the project
myBanner = (NativeBannerView) findViewById(R.id.banner_view);
My idea would be to intercept the click of the button that is inside the module, and launch%% of the project%.