Android Question Best way to create customview


Well-Known Member
Licensed User
Longtime User
I want to know what is the best way to create custom view from wrapping aar files.
it was already involved in a previous work but currently the library is outdated (dji drones ui ,
Basically I want to use it in BAXMainPage, I post part of the code of one of the previous wrapping... any suggestion thanks

package anywheresoftware.b4a.objects;

import anywheresoftware.b4a.AbsObjectWrapper;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.Events;
import anywheresoftware.b4a.BA.Hide;
import dji.common.error.DJIError;
import dji.common.util.CommonCallbacks.CompletionCallback;
import dji.common.util.CommonCallbacks.CompletionCallbackWith;
import dji.sdk.base.BaseComponent;
import dji.sdk.base.BaseComponent.ComponentListener;

@Events(values={"Result (Success As Boolean, ErrorMessage As String)",
        "ResultWithValue (Success As Boolean, ErrorMessage As String, Value As Object)"})
public class DJIBaseComponentWrapper<T> extends AbsObjectWrapper<T>{
    public void initialize(final BA ba, final String EventName) {
        final String eventName = EventName.toLowerCase(BA.cul);
        AbsObjectWrapper.getExtraTags(getObject()).put("ba", ba);
        AbsObjectWrapper.getExtraTags(getObject()).put("eventName", eventName);
        final Object o = getObject();
        if (o instanceof BaseComponent) {
            final BaseComponent com = (BaseComponent) o;
            com.setComponentListener(new ComponentListener() {

                public void onConnectivityChange(boolean paramBoolean) {
                    ba.raiseEventFromUI(com, eventName + "_componentconnectivitychanged", paramBoolean);

    @Hide BA getBA() {
        return (BA) AbsObjectWrapper.getExtraTags(getObject()).get("ba");
    public String getEventName() {
        return (String) AbsObjectWrapper.getExtraTags(getObject()).get("eventName");
    public void setTag(Object o) {
        AbsObjectWrapper.getExtraTags(getObject()).put("tag", o);
    public Object getTag() {
        return AbsObjectWrapper.getExtraTags(getObject()).get("tag");
    public boolean getConnected() {
        return ((BaseComponent)getObject()).isConnected();