Josh wrote:
> is there a way to create multiple button controls dynamically and to
> have the same listener handle all of them?
Sure, the same general way you might do it in Swing or SWT:
Button btn1=new Button(this);
Button btn2=new Button(this);
Button btn3=new Button(this);
btn1.setOnClickListener(hitMe);
btn2.setOnClickListener(hitMe);
btn3.setOnClickListener(hitMe);
View.OnClickListener hitMe=new View.OnClickListener() {
public void onClick(View v) {
// do something useful here
}
});
// add buttons to parent ViewGroup
--
Mark Murphy (a Commons Guy)
http://commonsware.com
_The Busy Coder's Guide to Android Development_ Version 1.9 Available!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---