i have subclass(extends activity) , drag activity happen in class, in drag mode can not use vibrator , fatal exception:
case dragevent.action_drag_location: int idv = (integer) v.getid(); if( idv==100) { mainactivity.btdel.setbackgroundresource(r.drawable.rounded); vibrator vib = (vibrator) getsystemservice(getapplicationcontext().vibrator_service); vib.vibrate(500); return true; } .......
could please me.
to perform vibration should this:
import android.os.vibrator;
then in on create
vibrator v = (vibrator) this.context.getsystemservice(context.vibrator_service);
then vibrate
// vibrate 500 milliseconds v.vibrate(500);
include permission in androidmanifest.xml file:
<uses-permission android:name="android.permission.vibrate"/>
Comments
Post a Comment