Android Tutorial [java] Custom View with Designer Support (Java library)

daemon

Active Member
Licensed User
Oh! I wrote that too early...

I see other attributes now but when trying to use any of them programatically, I get Object should first be initialized exception. I must be doing something wrong.
 

Erel

Administrator
Staff member
Licensed User
It will be difficult to combine ViewWrapper with a custom view.

There is a simpler option. You can expose the "base" view as a property and then the user will be able to access its properties:
B4X:
public ViewWrapper getView() {
 ViewWrapper vw = new ViewWrapper();
 vw.Object = <base view>;
 return vw;
}

B4A:
B4X:
CustomView.View.Visible = False
 

daemon

Active Member
Licensed User
Using that code, Eclipse gives warning that ViewWrapper is a raw type.
Even if I ignore that warning, B4A gives compilation error saying Unknown type android.view.ViewWrapper
 

Informatix

Expert
Licensed User
Using that code, Eclipse gives warning that ViewWrapper is a raw type.
Even if I ignore that warning, B4A gives compilation error saying Unknown type android.view.ViewWrapper
You have to specify the wrapped view class, e.g.:
ViewWrapper<TextView>
If you do not want to specifiy the class (because it is not unique), use <?>.
 
Top