Java Question extending TextView

stefanobusetto

Active Member
Licensed User
Longtime User
I'm trying to extend TextView

public class xnPanel extends TextView {
public xnPanel(Context context, AttributeSet attrs, int defStyle)
{ super(context, attrs, defStyle);
}

}

but when i load the library i get "xnPanel.layout already exists"
any suggestion
tanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Here is the code of Label:
B4X:
@ShortName("Label")
@ActivityObject
public class LabelWrapper extends TextViewWrapper<TextView> {
   @Override
   @Hide
   public void innerInitialize(final BA ba, final String eventName, boolean keepOldObject) {
      if (!keepOldObject)
         setObject(new TextView(ba.context));
      super.innerInitialize(ba, eventName, true);
   }
}
 

stefanobusetto

Active Member
Licensed User
Longtime User
I'm trying to fix some problems with the scrolling of my xnGrid.
So i'was thinking starting from scratch and not form a scrollview like now.

It could be also an idea creating a panel extending the PanelWrapper class.
I was trying now but i'm not been able.
Is it possible?

About the conflict the code i've posted is the whole class.
I always start from a very basic, but working, class before going on.
That's why i'm puzzeld!

Thanks again
You are always very fast in your answers
 

stefanobusetto

Active Member
Licensed User
Longtime User
Here is the code (all):
public class xnPanel extends PanelWrapper {
@Override
@Hide
public void innerInitialize(final BA ba, final String eventName, boolean keepOldObject) {
if (!keepOldObject)
setObject(???);
super.innerInitialize(ba, eventName, true);
}
}

to extend a textview i use:
public class xnPanel extends TextViewWrapper<TextView>
but for the panel
public class xnPanel extends PanelWrapper<Panel>
doesn't work

1) the PanelWrapper must be called without "<Panel>"?
If so which objects should be passed to setObject

2) if the PanelWrapper must be called with "<Panel>"
which import do i use?

Thanks
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…