Java Question findViewbyID for main layout

DevBaby

Active Member
Licensed User
Longtime User
I am calling a library method that requires me to pass the view object for my main layout. Is there a way to get / call the view object for my main layout as I am not using the R.id references the library expects?

B4X:
// Call showOffer with your main activity and main layout view as arguments, to anchor the popup correctly.
if(maybeOffer.isPresent()){
    wom.showOffer(this, findViewById(R.id.main_layout), maybeOffer.get());}

I believe that I may be on the right track with using ba.activity.finViewById(int), but I am not sure what int value to use to reference my main layout view.
 

DonManfred

Expert
Licensed User
Longtime User
findViewById with result in a VIEW to get....
So; you can try to give your layout (panel loaded with designer for example) to your lib (parameter as view) and instead of using findViewById you directly use the view

Alternatively you can use XML-Layouts and generate a r file
 

DevBaby

Active Member
Licensed User
Longtime User
findViewById with result in a VIEW to get....
So; you can try to give your layout (panel loaded with designer for example) to your lib (parameter as view) and instead of using findViewById you directly use the view

Alternatively you can use XML-Layouts and generate a r file

Thanks for you help, I will try your idea of passing the view to the library.
 
Top