Okay. To reproduce the problem:
Create a new project:
Add this class:
package com.break_test;
import java.io.IOException;
import java.util.UUID;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.content.Context;
public class Listener_Thread extends Thread {
public Listener_Thread(Context context) {
super();
this.context = context;
}
Context context;
@Override
public void run() {
BluetoothAdapter bluetoothAdapter = BluetoothAdapter
.getDefaultAdapter();
UUID uuid = UUID.fromString("1AF6F9C4-2164-43CE-80AB-3499041D5328");
try {
BluetoothServerSocket bss = bluetoothAdapter
.listenUsingInsecureRfcommWithServiceRecord("sync", uuid);
while (true)
{
BluetoothSocket bluetoothSocket = bss.accept();
// new Connected_Thread(context, bluetoothSocket).start();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Be sure to start the thread like so:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
new Listener_Thread(this).start();
}
Now put a breakpoint on this line in the thread:
BluetoothAdapter bluetoothAdapter = BluetoothAdapter
.getDefaultAdapter();
Run in debug and see that it never stops there.
On Friday, November 2, 2012 5:36:16 AM UTC-5, Todd wrote:
>
> I don't think it's an eclipse problem so much as a newbie problem. it's
> not getting triggered because that line isn't getting executed. Perhaps
> some code prior to that line is throwing an exception? Either way, Treking
> is right that you didn't give near enough information.
> On Nov 1, 2012 8:53 AM, "bob" <[email protected] <javascript:>>
> wrote:
>
>> For some reason, when I put a breakpoint on this line:
>>
>> BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
>>
>> it never gets triggered.
>>
>> Any ideas why?
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to
>> [email protected]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en