Android examples for Animation:Rotate Animation
start Rotate Animation
//package com.java2s; import android.content.Context; import android.os.Vibrator; import android.view.View; import android.view.animation.Animation; import android.view.animation.RotateAnimation; public class Main { private static final long[] VIBRATE_PATTREN = new long[] { 1, 100, 100, 100 };//from w ww.j av a2 s . c o m public static void startRotateAnimation(Context context, View view) { RotateAnimation ra = new RotateAnimation(-1, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); ra.setDuration(20); ra.setRepeatCount(17); ra.setRepeatMode(Animation.REVERSE); ra.setFillAfter(false); view.startAnimation(ra); try { Vibrator vibrator = (Vibrator) context .getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(VIBRATE_PATTREN, -1); } catch (Exception e) { } } }