Hi,
Thanks for your answer.
However, this implies that I'll have to declare setOnClickListener for
each button in my Activity object (in the constructor):
Button MyButton1 = (Button)findViewById(R.id.MyButton1);
generate_button.setOnClickListener(new
Button.OnClickListener() {
public void onClick(View v) {
updateLabel();
}
});
Button MyButton2 = (Button)findViewById(R.id.MyButton2);
generate_button.setOnClickListener(new
Button.OnClickListener() {
public void onClick(View v) {
updateLabel();
}
});
Button MyButton3 = (Button)findViewById(R.id.MyButton3);
generate_button.setOnClickListener(new
Button.OnClickListener() {
public void onClick(View v) {
updateLabel();
}
});
....
If I've got 100 buttons, it's gonna take me a while.
Is there any other way to do it?
On Jul 5, 11:01 am, Jaswant <[email protected]> wrote:
> It's simple:
> call setonClickListener() method for each button u'hv created.
> and in onClick() method u can find clicked button by checking its text
>
> eg:
> void onClick(View v)
> {
> MyCustButton btn=(MyCustButton )v;
> if(btn.getText().toString().equals("blabla"))
> ....................
>
>
>
>
>
>
>
> }
--
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en