易采站长站为您分析Android实现调用震动的方法,实例分析了Android中Vibrator类的调用与使用技巧,具有一定参考借鉴价值,需要的朋友可以参考下
本文实例讲述了Android实现调用震动的方法。,具体如下:
调用Android系统的震动,只需要一个类 那就是Vibrator ,这个类在hard包中,一看系统级的服务,又要通过manifest.xml文件设置权限了
- <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://www.easck.com/apk/res/android"
- package="uni.vibrator" android:versionCode="1"
- android:versionName="1.0"> <uses-sdk android:minSdkVersion="8" />
- <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".VibratorDemoActivity"
- android:label="@string/app_name"> <intent-filter>
- <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter> </activity>
- </application> <uses-permission android:name="android.permission.VIBRATE" />
- </manifest>
下面还是一起学习一下SDK吧
Class that operates the vibrator on the device.
If your process exits, any vibration you started with will stop.
//Vibrator类用来操作设备上的震动,如果你的线程退出了,那么启动的震动也会停止
public void vibrate (long[] pattern, int repeat)










