Currently there is only a definition for long press, so this API isn't all
that useful.  (This is also why the preference is hidden away in SpareParts,
it's not really ready for prime time.)  If you are giving feedback for a
long press, then you may want to use it...  but if you also feel the need to
have it ignore the preference, then please consider having your own
preference in your app since some users really dislike this stuff.

On Mon, Sep 28, 2009 at 8:44 AM, Lee <lee.wil...@googlemail.com> wrote:

>
> This one works for me:
>
> performHapticFeedback( HapticFeedbackConstants.LONG_PRESS,
> HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING );
>
> I remember having trouble getting other things to work.
>
> Fortunately I only use Haptic Feedback with a long press, otherwise
> the Code Cops might come calling.
>
> If really want to be hauled in front of a judge you can use the
> Vibrator service directly.
>
> Lee
>
> On Sep 28, 2:33 pm, James W <jpbwebs...@gmail.com> wrote:
> > I want to invoke the haptic feedback buzz when my ImageButton is
> > pressed, but I am not sure the best way to do it. I first checked that
> > my button was enabled for that, and isHapticFeedbackEnabled() returns
> > true.
> >
> > Then I am calling performHapticFeedback() with the constant
> > FLAG_IGNORE_GLOBAL_SETTING, as the docs indicate that will be used to
> > override any global settings.
> >
> > The doc is a little ambiguous, but it does imply that this is
> > something I can call at any time, so I am calling it in the
> > OnClickListener():
> >
> >      final ImageButton mybutton= (ImageButton) findViewById
> > (R.id.mybutton);
> >      mybutton.setOnClickListener(new View.OnClickListener()
> >      {
> >       public void onClick(View v)
> >             {
> >         mybutton.performHapticFeedback
> > (HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
> >                 // The rest of my code
> >             }
> >         }
> >         );
> >
> > I appreciate that it would be better to call it when the finger first
> > touches the button rather than on the Click event, but I wanted to get
> > it working to start with, before refining it.
> >
> > Am I barking completely up the wrong tree, or should the above work
> > when I click on the button, because nothing happens?
> >
>


-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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