Java Question Reference to UI view

ribber

Member
Licensed User
Longtime User
Hi all,

I would like to access in my custom lib the UI views created by the designer. During my search in the forum I found that I've to assign the @ActivityObject and BA parameter to my class/methods. Unfortunately I didn't found any example how to access UI views in java.

Can someone give me an short example? Maybe how to change the visibility of a view in my custom java lib?

Thanks!
 

ribber

Member
Licensed User
Longtime User
Thank you for your quick answer Erel!

In the first step I want to access a single view. But it would be great if you can give me a short example for both cases.
 

XverhelstX

Well-Known Member
Licensed User
Longtime User
You can access a view like the following:

B4X:
/**
* Cancels a long press.
*
*/
public void cancelLongPress(View v) {
v.cancelLongPress();
}

v. can be the methods found here:
View | Android Developers

in Basic4Android you would need this then (as an example):
B4X:
dim ml as mylibrary
dim btn as button
ml.cancelLongPress(btn)

Tomas
 
Top