开发者

Vibrator in android

开发者 https://www.devze.com 2023-01-30 13:30 出处:网络
How to create Vibrator object and call vibrate function? http://developer.android.com/reference/android/os/Vibrator.html doesn\'t give muc开发者_如何学Pythonh information regarding how to create the o

How to create Vibrator object and call vibrate function? http://developer.android.com/reference/android/os/Vibrator.html doesn't give muc开发者_如何学Pythonh information regarding how to create the object ( no public constructors )


I think you're looking for:

Vibrator bzzz = (Vibrator) getSystemService(VIBRATOR_SERVICE);

See the docs.


You have to create the object then call the function object.vibrate whith vibration period in milliseconds

Vibrator v = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE);
// To vibrate for 1 second
v.vibrate(1000);
0

精彩评论

暂无评论...
验证码 换一张
取 消