use array.... Button btn[]...then u can use looping for it...


On 30 April 2010 23:37, Brion Emde <brione2...@gmail.com> wrote:
> you could do something like putting your ids in an array and putting
> your discovered buttons in another array and then process them in a
> loop.
>
> Think about how SimpleCursorAdapter is doing what it does.
>
> http://developer.android.com/reference/android/widget/SimpleCursorAdapter.html
>
> Take a look at the constructor.
>
> On Apr 30, 9:46 am, "angushir...@googlemail.com"
> <angushir...@yahoo.co.uk> wrote:
>> Dear all,
>>             I'm implementing an app that has 12 buttons placed in a
>> grid. When one is pressed, the number that the button displays
>> (through button.getText()) has to be retrieved and passed to a common
>> method. I've gone down the route of implementing OnClickListener e.g.
>> public class WordRecall extends Activity implements OnClickListener
>>
>> and then overriding public void onClick(View v) to handle events.
>> However, what I want to avoid is having to repeat the following lines
>> 12 times :
>>
>> Button btn4Button = (Button)findViewById(R.id.fourWords);
>>                 btn4Button.setOnClickListener(this);
>>
>> Is there a way in Android 1.5 of avoiding this as there is in 1.6?
>>
>> Am I better off using 1.6 for development instead of 1.5?
>>
>> Regards
>>
>> Angus
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group 
>> athttp://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Best Regard
Sajarwo Anggai
Research & Development Staff
SEAMEO-SEAMOLEC
Kompleks Universitas Terbuka
Jl. Cabe Raya, Pondok Cabe, Pamulang 15418
PO BOX 59/CPA Ciputat 15401, Tangerang, Indonesia
Phone    : (62-21) 7422184, 7423725
Fax        : (62-21) 7422276
Website : http://seamolec.org
HP: +62852 33 46 46 48

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to