title: Android: Vibrator doesn't work. Foce Close emulator
body: <p>hey Guys, I'm still an Android &amp; Java noob, but everything I've seen is telling me this should totally work, but it doesn't!  not in the emulator, not on the phone..  I'm trying to use the vibrator using vibrate(500);  ..I get an " application stopped unexpectedly " error</p>
  
  <p>what am I missing?</p>
  
  <p>code below:</p>
  
  <pre><code>package com.phys;
  
  import android.app.Activity;
  import android.content.Context;
  import android.os.Bundle;
  import android.os.Vibrator;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.TextView;
  
  public class phys extends Activity {
  
   Vibrator vibr;
   Button but;
   TextView txt;
   int counter = 0;
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          vibr = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
          but = (Button)findViewById(R.id.Button01);
          txt = (TextView)findViewById(R.id.txt);
          but.setOnClickListener(clk);
      }
  
      OnClickListener clk = new OnClickListener(){
  
    @Override
    public void onClick(View v) {
     // TODO Auto-generated method stub
     txt.setText(Integer.toString(counter));
     //do something else
     vibr.vibrate(500);
     counter++;
    }
  
      };
  }
  </code></pre>