0
私のアプリケーション: /** *ブルートゥーススマートフォンを接続します。 * Bluetoothとボタンで自動ブルートゥースをオフに */アンドゥーノのArduinoブルートゥース
package com.Iris;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import java.util.Set;
public class IrisActivity extends Activity
{
Button button1;
// button Off bluettooch
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button1 = (Button) findViewById(R.id.button1);
final BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
// ac
bluetoothAdapter.enable();
Toast.makeText(IrisActivity.this, "Bluetooth Activé", Toast.LENGTH_SHORT).show();
Set<BluetoothDevice> devices;
devices = bluetoothAdapter.getBondedDevices();
for (BluetoothDevice blueDevice : devices)
{
Toast.makeText(IrisActivity.this, "Réseau : " + blueDevice.getName(), Toast.LENGTH_SHORT).show();
}
button1.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
bluetoothAdapter.disable();
Toast.makeText(IrisActivity.this, "Bluetooth Désactivé", Toast.LENGTH_SHORT).show();
}
});
}
私のアプリケーションが良いですが、私は「blueDevice.getName」で接続して、自分のアプリケーションでASCI文字「H」を送信したい
缶私を助けて?
ありがとうございます。ただし、このコードを自分のコードに含めてください。ありがとう – user1255077