Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Constructor Vibrator() is not visible

Im building an Android application in eclipse and i get the error:

constructor Vibrator() is not visible

I have no clue how to solve this issue can you help? Here is the section of the code:

@Override
public void onCreate() {
    mVibrator = new Vibrator();
    // Listen for incoming calls to kill the alarm.
    mTelephonyManager =
            (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    mTelephonyManager.listen(
            mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
    AlarmAlertWakeLock.acquireCpuWakeLock(this);
}
like image 770
user1185205 Avatar asked Dec 30 '25 20:12

user1185205


1 Answers

You are not supposed to create a new Vibrator instance (therefore the constructor is invisible to you), you should rather get an existing one from the system:

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

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!