Vibrator.vibrate()抛出ArrayIndexOutOfBoundsException

我使用以下代码片段以特定模式振动手机,但它会抛出和ArrayIndexOutOfBoundsException。
vibrator.vibrate(new long[] { selectedDuration, CONSTANT_DELAY }, REPEAT); 
vibrator.vibrate(VIBRATE_DURATION);
工作良好。有什么指针吗?     
已邀请:
文档说:   如果要重复,请将索引传递到开始重复的模式。 意味着在您的情况下,REPEAT只允许为0或1。 这是实施:
public void vibrate(long[] pattern, int repeat)
{
    // catch this here because the server will do nothing.  pattern may
    // not be null, let that be checked, because the server will drop it
    // anyway
    if (repeat < pattern.length) {
        try {
            mService.vibratePattern(pattern, repeat, mToken);
        } catch (RemoteException e) {
        }
    } else {
        throw new ArrayIndexOutOfBoundsException();
    }
}
    

要回复问题请先登录注册