1

I'm trying to get the Android Vibrator to pulse once when the user has held down an image for a second or so.

I've added the permission for it in my manifest file.

I think the problem is that I'm not calling the code from inside the activity, I'm creating a game so the code is running from within the onTouch function.

I've tried (As well as some combinations of the below):

Vibrator v  = (Vibrator) Context.getSystemService(VIBRATOR_SERVICE);

That says that it can't cast from String to Vibrator class, which I don't understand why! I assume that it's something to do with the code being called outside of the Activity - Bonus points for explaining why that's an issue!

Thanks.

Kevin Pione
  • 299
  • 3
  • 12
  • 1
    Try passing the context to the code -http://stackoverflow.com/questions/4870667/how-can-i-use-getsystemservice-in-a-non-activity-class-locationmanager – user1378730 Nov 25 '12 at 22:32

0 Answers0