My phone isnt vibrating when i press the button?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/8860386/why-isnt-my-phone-vibrating-when-i-press-the-button">Why isnt my phone vibrating when i press the button?</a>  </p>
</blockquote>



<p>Hi im trying to make it that when a user clicks on on a button the phone vibrates. Heres manifest.xml and AndroidVibrator.java so whats wrong? how can i fix it? thanks!</p>

<p>heres the manifest file i did declare the permissions in manifest as u can see:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="android.app"
    android:versionCode="1"
    android:versionName="1.0" &gt;

    &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;

    &lt;uses-sdk android:minSdkVersion="7" /&gt;

    &lt;application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" &gt;
        &lt;activity
            android:name=".AndroidActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;

                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        &lt;activity
            android:name=".activity2"
            android:label="@string/app_name"
            android:screenOrientation="portrait" &gt;
        &lt;/activity&gt;
        &lt;activity
            android:name=".activity3"
            android:label="@string/app_name"
            android:screenOrientation="portrait" &gt;
        &lt;/activity&gt;

         &lt;activity
            android:name=".AndroidVibrator"
            android:label="@string/app_name"
            android:screenOrientation="portrait" &gt;
        &lt;/activity&gt;

        &lt;activity android:name=".next" &gt;
        &lt;/activity&gt;
    &lt;/application&gt;

&lt;/manifest&gt;
</code></pre>

<p>And heres AndroidVibrator, did i declare the activity for it correctly? what am i missing?:</p>

<pre><code>package android.app;
import android.app.R;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.View;
import android.os.Vibrator;

public class AndroidVibrator extends Activity implements OnClickListener
{
    private View myView;
    private Vibrator myVib;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        myVib = (Vibrator) this.getSystemService(VIBRATOR_SERVICE);

        //myView can be any type of view, button, etc.
        myView = (View) this.findViewById(R.id.sound);
        myView.setOnClickListener((android.view.View.OnClickListener) this);
    }

    public void onClick(View v)
    {
        myVib.vibrate(500);
        //add whatever you want after this
    }

    public void onClick(DialogInterface arg0, int arg1) {
        // TODO Auto-generated method stub

    }
}
</code></pre>

<p>Im not getting errors,its just not vibrating when i press the button. Thanks for any help!</p>
