Android Question [Solved] handling same view-event from several activities in one place?

Pflichtfeld

Active Member
Licensed User
I use same textboxes in a layout, which is loaded in different activities.
I have to handle the Enter_pressed-Event allways in the same manner in the different activities.
I thought, I could put the event to starter, but adding 'starter.' to the event in designer is not accepted.
I am quite sure this is possible somehow, but I do not know how.
Can anybody help me here please?
 

Pflichtfeld

Active Member
Licensed User
Thank you Erel, I was trying today, but am not successful.
Do I understand you correct, that I rebuild a edittext view in a custom view class? That is a task I cannot do yet.
Or is it possible to subclass a edittext view? Also here I am making no progress.
I watched your classvideo, but I could not see, how to apply it in my case.
I've been searching the forum for a example or helpful tutorial but without success.
Will now study the b4X Custom view booklet and come back if I get stuck.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You don't need to implement it as a custom view (though it is an option).
Just move all the relevant code and the layout file to the class and create a class instance in each of the activities.

You can pass the Activity itself to the class Initialize sub. This will allow you to load layout to the activity.
 
Upvote 0
Top