Android Bluetooth -Absturzanwendung

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Android Bluetooth -Absturzanwendung

by Anonymous » 07 Apr 2025, 01:03

Probleme mit der Verwendung von Device.getName () . Es ist aus irgendeinem Grund, dass meine Bewerbung zum Absturz gebracht wird. < /p>

Ich mache einen Adapter (Halten von Bluetooth -Namen) in einem Dialogfeld. Wenn ich die Anwendung ausführe und Geräte füge.

Code: Select all

mBluetoothAdapter.startDiscovery();
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();

if (BluetoothDevice.ACTION_FOUND.equals(action)) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);

toothadapter.add(device.getName());
toothadapter.notifyDataSetChanged();
}
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(bluetooth.this);
builder.setTitle("Nearby Devices:");
builder.setAdapter(toothadapter, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {

}
});
AlertDialog alert = builder.create();
alert.show();

IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
registerReceiver(receiver, filter);
benötigen wirklich Hilfe dafür, warum dies geschieht.>

Top