"The application has stoped unexpectadly" error in Android
<p>java file---Bttest11.java</p>

<pre><code>**package niebttest11.example.bluetoothtesta;
/*import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class Bttest11 extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bttest11);
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.bttest11, menu);
        return true;
    }
    */
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
public class Bttest11 extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {  

        int state = intent.getExtras().getInt(BluetoothAdapter.EXTRA_STATE);

     switch (state) {

   case BluetoothAdapter.STATE_OFF:

      Toast.makeText(context, "Off", Toast.LENGTH_SHORT).show();

           break;

   case BluetoothAdapter.STATE_TURNING_OFF:

   Toast.makeText(context, "Turning Off", Toast.LENGTH_SHORT).show();

        break;

     case BluetoothAdapter.STATE_ON:
            Toast.makeText(context, "On", Toast.LENGTH_SHORT).show();

          break;

 case BluetoothAdapter.STATE_TURNING_ON:

      Toast.makeText(context, "Turning On", Toast.LENGTH_SHORT).show();

         break;
        }
    }
}**



//manifest file---Bluetoothtest11 Manifest


&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="niebttest11.example.bluetoothtesta"
    android:versionCode="1"
    android:versionName="1.0" &gt;

    &lt;uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="8" /&gt;
    &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/&gt;
    &lt;uses-permission android:name="android.permission.BLUETOOTH"/&gt;


    &lt;application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" &gt;
        &lt;activity
            android:name="niebttest11.example.bluetoothtesta.Bttest11"
            android:label="@string/app_name" &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;receiver android:name="Bttest11" &gt;
            &lt;intent-filter&gt;
            &lt;action android:name="android.bluetooth.adapter.action.ACTION_FOUND"/&gt;
            &lt;action android:name="android.bluetooth.adapter.action.ACTION_DISCOVERY_FINISHED"/&gt;

            &lt;/intent-filter&gt;
        &lt;/receiver&gt;
    &lt;/application&gt;

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

<p>ERROR:</p>

<blockquote>
  <p>The code is running.But while running .apk in an android phone,it will show an error that,"The application Bluetoothtest11(process nietest11.example.buetoothtesta) has stoped unexpectadly".</p>
</blockquote>
