In onClick or onLongClick, the button is not pressed anymore. You need
to use your own onTouchEvent/onKeyEvent implementations.

On Sat, Oct 25, 2008 at 5:28 PM, cyntacks <[EMAIL PROTECTED]> wrote:
>
> Hey Romain,
>
> It seems as if you are as big of a geek as me (posting on Saturday
> night), but I guess that is a good thing!
>
> So, I should have mentioned I tried the OnLongClick as well.. I could
> get it to register the long click, but that was it. Please take a look
> at my example:
>
> exampleButton.setLongClickable(true);
>        exampleButton.setOnLongClickListener(new
> View.OnLongClickListener() {
>             public boolean onLongClick(View v) {
>                System.out.println("LONG...");
>                //Do something
>                 return true;
>             }
>        });
>
> Now, this is obviously wrong if OnLongCLick is the way to go, so what
> am I missing here? I attempted to put an "isPressed()" while-loop
> inside, but it apears "isPressed()" doesn't change to false.
>
> As always, thanks for the help,
>
> Kevin
>
>
>
>
>
> For example, if I held the button for the desired period of time
> OnLongClick would be called, but only once.
>
>  "semi-" get this to work. When testing I was able to "see" the long
> click being called by logging some output, but it only logs once.
>
>
>
>
>
> On Oct 25, 8:09 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
>> A click is sent on button up, so you cannot do it this way. You should use
>> an OnLongClickListener instead (after making sure you set the View long
>> clickable.) Otherwise you would need to listen for key/touch events, start a
>> timer and perform the long click when the timer runs out (we do it with a
>> simple delayed message in the framework.)
>>
>> On Oct 25, 2008 4:06 PM, "cyntacks" <[EMAIL PROTECTED]> wrote:
>>
>> Ok, this is really KILLING me. I just went through the Button/View/
>> Listener's API again and still can't figure this out.
>>
>> When a button is pressed onClick(View v) of the OnClickListner is
>> called, but how can I determine if the button is being held? I want to
>> perform "x" action while the user "holds" the button...
>>
>> I had hoped isPressed() would help, but can't seem to figure it out. I
>> know this can be done as the DatePickerDialog implements this, but I
>> haven't gotten around to installing the actual source yet...
>>
>> Anyone know how to do this?
>>
>> Kevin
> >
>



-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to