Sorry, the design requirements of the problem are not very clear from
the description of the post.
Do you want to run the loop for a finite for every push down or only
while the button is pushed down.

Here are some ideas if they help solve your issue.

You can add View.OnKeyListener and View.OnTouchListener (if you want
to touch enable the button)

Implement the onKey method with something like this

 public boolean onKey(View v, int keyCode, KeyEvent event) {
     if (event.getAction() == KeyEvent.ACTION_DOWN){

                        while (myVariable != 0){
                          myVariable--;
                          audioAlert();
                        }
                        myVariable = 1000; // re-initialize
                        return true;
                }else if (event.getAction() == KeyEvent.ACTION_UP){

                        return true;
                }

                return false;
        }
If this is not what you are looking for, kindly give more details.
Also, for the audioAlert you may want to initialize it only once and
then just play a sound in the loop.

Balwinder Kaur
Open Source Development Center
·T· · ·Mobile· stick together

The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.


On Aug 10, 10:59 pm, Hugh <[email protected]> wrote:
> Anyone?
>
> It's just that the code posted i think will only sound once and you
> will have to click it again for it to sound again?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to