• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Reflection in body of event handler

aspilicious

Lurker
Mar 31, 2010
2
0
Hi all,

My first question ever on this thing, hopefully you guys are heros... ;)

I'm building a android application that is able to load layouts at runtime. This is made possible with help of reflection and a special xml file (calles uiml).

Besides layouts uiml can handle events. So I need to take care of events in dynamic way.

My questions:

1) Is het possible to invoke clickhandlers with reflection.
// probably not

2) Is het possible to invoke the body of the onClick(View v) function with reflection.

for example:

button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
tv.setText(firstField.getValue() + " " + lastField.getValue());
}
} );

is it possible to invoke: tv.setText(firstField.getValue() + " " + lastField.getValue()); dynamicly. (reflection).

If I'm not clear enough please tell me :)
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones