DroidForums.net is the original Verizon Android Forum! Registered Users do not see these ads. Please Register - It's Free!
Results 1 to 1 of 1

Thread: Bluetooth discovery app; uncaught handler exception

  1. Junior Droid
    chris24300's Avatar
    Member #
    24703
    Join Date
    Jan 2010
    Posts
    24
    Phone
    Enter Current Phone Here
    #1

    Bluetooth discovery app; uncaught handler exception

    Hi, I'm getting an error when I try to search for bluetooth devices and ask the user which device they'd like to connect to. I get an uncaught handler exception, but I do not know how to fix it. This is output from ddms

    Code:
    05-17 14:27:11.405: ERROR/AndroidRuntime(6972): Uncaught handler: thread main exiting due to uncaught exception
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.bluetooth.device.action.FOUND (has extras) } in com.textron.btconfig.BTConfig$1@447af2f8
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:765)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at android.os.Handler.handleCallback(Handler.java:587)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at android.os.Handler.dispatchMessage(Handler.java:92)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at android.os.Looper.loop(Looper.java:123)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at android.app.ActivityThread.main(ActivityThread.java:4363)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at java.lang.reflect.Method.invokeNative(Native Method)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at java.lang.reflect.Method.invoke(Method.java:521)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at dalvik.system.NativeStart.main(Native Method)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972): Caused by: java.lang.NullPointerException
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at com.textron.btconfig.BTConfig$1.onReceive(BTConfig.java:136)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:754)
    05-17 14:27:11.413: ERROR/AndroidRuntime(6972):     ... 9 more
    Here is my code
    Code:
    ba.startDiscovery();
            // Create a BroadcastReceiver for ACTION_FOUND
            mReceiver = new BroadcastReceiver() 
            {
                public void onReceive(Context context, Intent intent) 
                {
                    String action = intent.getAction();
                    // When discovery finds a device
                    if (BluetoothDevice.ACTION_FOUND.equals(action)) 
                    {
                        Log.d("BT", "Device Found");
                        // Get the BluetoothDevice object from the Intent
                        BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
                        // add device to a list
                        alert.setTitle("Device Found");
                        alert.setMessage("Device Name: " + device.getName() + ", Device Address: " + device.getAddress());
                        alert.setButton("Connect", new OnClickListener()
                        {
                            public void onClick(DialogInterface dialogI, int which) 
                            {
                                try 
                                {
                                    Log.d("BT", "SUCCESS");
                                } 
                                catch (Exception e) 
                                {
                                    e.printStackTrace();
                                    Log.e("BT", "Alert dialog");
                                }
                            }
                        });
                        
                        alert.setButton2("Next", new OnClickListener() 
                        {
                            public void onClick(DialogInterface dialogI, int which)
                            {
                                return;
                            }
                        });
                        alert.show();
                    }
                }
            };
            // Register the BroadcastReceiver
            IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
            registerReceiver(mReceiver, filter); // Don't forget to unregister during onDestroy
  2.  
     
     
     

Links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. Exception Processing Message
    By Agrajag in forum Android Tech Support
    Replies: 2
    Last Post: 07-06-2010, 09:55 AM
  2. Snip from Discovery...
    By butch350 in forum Android General Discussions
    Replies: 0
    Last Post: 03-09-2010, 10:48 AM
  3. Discovery Channel app released
    By cisco0910 in forum Android Applications
    Replies: 11
    Last Post: 01-16-2010, 06:01 AM
  4. Watchdog Exception Error?
    By aeroworks in forum Android Tech Support
    Replies: 0
    Last Post: 01-09-2010, 10:50 PM
  5. new droid handler...
    By 04blkep3 in forum New Member Introductions & Site Assistance
    Replies: 5
    Last Post: 11-29-2009, 01:58 PM

Search tags for this page

android bluetooth discovery
,
android bluetooth startdiscovery
,
android development bluetooth startdiscovery
,
android uncaught handler: thread main exiting due to uncaugh
,
bluetooth discovery error -25
,
error receiving broadcast intent
,

error receiving broadcast intent { act=android.bluetooth.dev

,

java.lang.runtimeexception: error receiving broadcast intent

,
uncaught handler
,

uncaught handler: thread main exiting due to uncaught except

Click on a term to search our site for related topics.
Find us on Google+